PDA

View Full Version : error 001: expected token: ";", but found ")"


Oscii
17/07/2012, 05:23 PM
Error Codes
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Code that has the errors.

if(Player[playerid][Banned] == 1 || Player[playerid][Banned] == 2 || Player[playerid][Banned] == 4)
{
new second, hour, minute, day, year, month;
new RemoveUnderScore;
gettime(hour, minute, second);
getdate(year, month, day);
new IP[21];
GetPlayerIp(playerid, IP, sizeof(IP));
SendClientMessage(playerid, ANNOUNCEMENT, "{FF3300}Your IP has been banned from the server.");
format(string, sizeof(string), "Ban: %s has been auto-banned, defined reason: Attempted Ban Evasion.", RemoveUnderScore(playerid));
printf("Ban %s has been banned by the Auto Ban. [Reason: Ban Evading.]", Name);
format(post_string, sizeof(post_string), "action=addban&apikey="#APIKEY"&ban_user=%s&ban_reason=Ban Evading&ban_admin=Auto-ban&ban_ip=%s",Player[playerid][NormalName], ips[playerid];
HTTP(playerid, HTTP_POST, APIPATH, post_string, "OnBanResponse");
Ban(playerid);
return 1;
}

I really dont understand how its going wrong O_o

Parka
17/07/2012, 05:25 PM
if(Player[playerid][Banned] == 1 || Player[playerid][Banned] == 2 || Player[playerid][Banned] == 4)
{
new second, hour, minute, day, year, month;
new RemoveUnderScore;
gettime(hour, minute, second);
getdate(year, month, day);
new IP[21];
GetPlayerIp(playerid, IP, sizeof(IP));
SendClientMessage(playerid, ANNOUNCEMENT, "{FF3300}Your IP has been banned from the server.");
format(string, sizeof(string), "Ban: %s has been auto-banned, defined reason: Attempted Ban Evasion.", RemoveUnderScore(playerid));
printf("Ban %s has been banned by the Auto Ban. [Reason: Ban Evading.]", Name);
format(post_string, sizeof(post_string), "action=addban&apikey="APIKEY"&ban_user=%s&ban_reason=Ban Evading&ban_admin=Auto-ban&ban_ip=%s",Player[playerid][NormalName], ips[playerid];
HTTP(playerid, HTTP_POST, APIPATH, post_string, "OnBanResponse");
Ban(playerid);
return 1;
}

Oscii
17/07/2012, 05:26 PM
Still have the same errors.. :(

hansen111
17/07/2012, 05:29 PM
what is this for?:

new RemoveUnderScore;

Oscii
17/07/2012, 05:35 PM
thats basically, GivePlayerName

hansen111
17/07/2012, 05:36 PM
format(post_string, sizeof(post_string), "action=addban&apikey="#APIKEY"&ban_user=%s&ban_reason=Ban Evading&ban_admin=Auto-ban&ban_ip=%s",Player[playerid][NormalName], ips[playerid];


You need to close your format function call so you get instead:

format(post_string, sizeof(post_string), "action=addban&apikey="#APIKEY"&ban_user=%s&ban_reason=Ban Evading&ban_admin=Auto-ban&ban_ip=%s",Player[playerid][NormalName], ips[playerid]);

Tuntun
17/07/2012, 05:38 PM
Try

if(Player[playerid][Banned] == 1 || Player[playerid][Banned] == 2 || Player[playerid][Banned] == 4);
{
new second, hour, minute, day, year, month;
new RemoveUnderScore;
gettime(hour, minute, second);
getdate(year, month, day);
new IP[21];
GetPlayerIp(playerid, IP, sizeof(IP));
SendClientMessage(playerid, ANNOUNCEMENT, "{FF3300}Your IP has been banned from the server.");
format(string, sizeof(string), "Ban: %s has been auto-banned, defined reason: Attempted Ban Evasion.", RemoveUnderScore(playerid));
printf("Ban %s has been banned by the Auto Ban. [Reason: Ban Evading.]", Name);
format(post_string, sizeof(post_string), "action=addban&apikey="APIKEY"&ban_user=%s&ban_reason=Ban Evading&ban_admin=Auto-ban&ban_ip=%s",Player[playerid][NormalName], ips[playerid];
HTTP(playerid, HTTP_POST, APIPATH, post_string, "OnBanResponse");
Ban(playerid);
return 1;
}

Oscii
17/07/2012, 05:41 PM
still noany work :(

hansen111
17/07/2012, 05:43 PM
wont work tuntun, he forgot a closing bracket ")" at the end where he calls format on the string he uses in HTTP() function call. Just change what i posted oscii.

Tuntun
17/07/2012, 05:45 PM
ok try this:

if(Player[playerid][Banned] == 1 || Player[playerid][Banned] == 2 || Player[playerid][Banned] == 4))
{
new second, hour, minute, day, year, month;
new RemoveUnderScore;
gettime(hour, minute, second);
getdate(year, month, day);
new IP[21];
GetPlayerIp(playerid, IP, sizeof(IP));
SendClientMessage(playerid, ANNOUNCEMENT, "{FF3300}Your IP has been banned from the server.");
format(string, sizeof(string), "Ban: %s has been auto-banned, defined reason: Attempted Ban Evasion.", RemoveUnderScore(playerid));
printf("Ban %s has been banned by the Auto Ban. [Reason: Ban Evading.]", Name);
format(post_string, sizeof(post_string), "action=addban&apikey="APIKEY"&ban_user=%s&ban_reason=Ban Evading&ban_admin=Auto-ban&ban_ip=%s",Player[playerid][NormalName], ips[playerid];
HTTP(playerid, HTTP_POST, APIPATH, post_string, "OnBanResponse");
Ban(playerid);
return 1;
}

hansen111
17/07/2012, 05:50 PM
Also found another error in your format function call, instead of this:


format(post_string, sizeof(post_string), "action=addban&apikey="APIKEY"&ban_user=%s&ban_reason=Ban Evading&ban_admin=Auto-ban&ban_ip=%s",Player[playerid][NormalName], ips[playerid];


Use this:

format(post_string, sizeof(post_string), "action=addban&apikey=APIKEY&ban_user=%s&ban_reason=Ban Evading&ban_admin=Auto-ban&ban_ip=%s",Player[playerid][NormalName], ips[playerid]);


It compiles fine here.

Tuntun
17/07/2012, 05:52 PM
Also found another error in your format function call, instead of this:


format(post_string, sizeof(post_string), "action=addban&apikey="APIKEY"&ban_user=%s&ban_reason=Ban Evading&ban_admin=Auto-ban&ban_ip=%s",Player[playerid][NormalName], ips[playerid];


Use this:

format(post_string, sizeof(post_string), "action=addban&apikey=APIKEY&ban_user=%s&ban_reason=Ban Evading&ban_admin=Auto-ban&ban_ip=%s",Player[playerid][NormalName], ips[playerid]);


It compiles fine here.

ho really??
i test you are script and see:

F:\test.pwn(6) : error 021: symbol already defined: "gettime"
F:\test.pwn(9) : error 021: symbol already defined: "GetPlayerIp"
F:\test.pwn(15) : error 021: symbol already defined: "Ban"
F:\test.pwn(16) : error 010: invalid function or declaration
F:\test.pwn(18) : warning 203: symbol is never used: "IP"
F:\test.pwn(18) : warning 203: symbol is never used: "RemoveUnderScore"
F:\test.pwn(18) : warning 203: symbol is never used: "day"
F:\test.pwn(18) : warning 203: symbol is never used: "hour"
F:\test.pwn(18) : warning 203: symbol is never used: "minute"
F:\test.pwn(18) : warning 203: symbol is never used: "month"
F:\test.pwn(18) : warning 203: symbol is never used: "second"
F:\test.pwn(18) : warning 203: symbol is never used: "year"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.

hansen111
17/07/2012, 05:56 PM
I meant on the format line where i corrected 2 errors, these new errors are something new and you have not posted any code that will result in those errors as far as i can see.