SA-MP Forums Archive
error 001: expected token: ";", but found "if" - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: error 001: expected token: ";", but found "if" (/showthread.php?tid=657752)



error 001: expected token: ";", but found "if" - ZigGamerx - 15.08.2018

am getting a error

Код:
error 001: expected token: ";", but found "if"
Код:
public OnPlayerText(playerid, text[])
{
    SpamTimer[playerid] = SetTimerEx("DecreaseSpam",MAX_DECREASECOUNT*1000,1,"d",playerid)
    if(PlayerSpam[playerid] < MAX_SPAM)
    {
    PlayerSpam[playerid] ++;
    }
    else if(PlayerSpam[playerid] >= MAX_SPAM)//If the player spam is bigger than or equal to the max spam allowed!
    {
    new TalkString[120],string[120];
    //WE FORMAT THE STRING
    format(string,sizeof(string),"[ANTI-CHEAT] Player: %s ID: %d Has been Kicked Reason: SPAM",GetName(playerid),playerid);
    //THEN WE SEND IT TO EVERYONE!
    SendClientMessageToAll(-1,string);
    format(TalkString,sizeof(TalkString),"You Have Been Kicked By Anti Cheat!\nReason:SPAM");
    //we are going to show the dialog to the player
    ShowPlayerDialog(playerid,DIALOG_ANTI,DIALOG_STYLE_MSGBOX,"Anti Cheat!",TalkString,"Okay","");
    //we set the playerspam to 0 so it wont mix with other players when they connect!
    PlayerSpam[playerid] = 0;
    //we kill the timer!
    KillTimer(SpamTimer[playerid]);
    //Then we kick the player!
    Kick(playerid);
    }
	return 1;
}
Код:
 line 270 if(PlayerSpam[playerid] < MAX_SPAM)



Re: error 001: expected token: ";", but found "if" - Wreeper - 15.08.2018

line 270 if(PlayerSpam[playerid] < MAX_SPAM);

You forgot to add a ;

rep if worked


Re: error 001: expected token: ";", but found "if" - ZigGamerx - 15.08.2018

Код:
G:\Pawno\gamemodes\cod.pwn(293) : loose indentation
G:\Pawno\gamemodes\cod.pwn(472) : error 001: expected token: ";", but found "if"
G:\Pawno\gamemodes\cod.pwn(472) : error 036: empty statement
G:\Pawno\gamemodes\cod.pwn(476) : error 029: invalid expression, assumed zero
G:\Pawno\gamemodes\cod.pwn(476) : warning 215: expression has no effect
G:\Pawno\gamemodes\cod.pwn(476) : error 001: expected token: ";", but found "if"
G:\Pawno\gamemodes\cod.pwn(568) : loose indentation
G:\Pawno\gamemodes\cod.pwn(639) : loose indentation
G:\Pawno\gamemodes\cod.pwn(686) : warning 209: function "OnPlayerUpdate" should return a value
G:\Pawno\gamemodes\cod.pwn(151) : symbol is never used: "PlayerStatsTimer"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2016, ITB CompuPhase


4 Errors.



Re: error 001: expected token: ";", but found "if" - coool - 15.08.2018

You have forgot a ';' in the upper line
Код:
SpamTimer[playerid] = SetTimerEx("DecreaseSpam",MAX_DECREASECOUNT*1000,1,"d",playerid);
added a `;` in last. The semi-colon; indicates an statement's end.



Quote:
Originally Posted by Wreeper
Посмотреть сообщение
rep if worked
His posts are below 50 his rep power is 0.


Re: error 001: expected token: ";", but found "if" - ZigGamerx - 15.08.2018

thanks cool