SA-MP Forums Archive
Error 001: Expected token: ";" but found "return" - 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 "return" (/showthread.php?tid=522799)



Error 001: Expected token: ";" but found "return" - bradleyofniet - 29.06.2014

Sup guys,
I got a problem,
If I compile my gamemode it shows up this error:
Код:
C:\Users\Gebruiker\Documents\GTA San Andreas\samp servers\Fast Hustler Roleplay V4.0\gamemodes\EXRPR48.pwn(31735) : error 001: expected token: ";", but found "return"
Here's the part where the error is:
Код:
CMD:destroyallflares(playerid, params[])
{
	if(!IsACop(playerid))
 	{
  		return SendClientMessage(playerid,COLOR_GREY,"   You cannot use this command !");
    }
    if(IsACop(playerid))
    {
    	if(PlayerInfo[playerid][pRank] < 6)
	    {
     		return SendClientMessage(playerid,COLOR_GREY,"   Your rank is too low to be removing flares !");
	    	}
		}
		else
		{
  		if(PlayerInfo[playerid][pRank] < 5)
    	{
      		return SendClientMessage(playerid,COLOR_GREY,"   Your rank is too low to be removing flares !");
  		}
	}
	DeleteAllFlare()
  	return 1; //THIS LINE
}
Here's where the Deleteallflare function is defined:
Код:
stock DeleteAllFlare()
{
    for(new i = 0; i < sizeof(FlareInfo); i++)
  	{
  	    if(FlareInfo[i][fCreated] == 1)
  	    {
  	        FlareInfo[i][fCreated]=0;
            FlareInfo[i][fX]=0.0;
            FlareInfo[i][fY]=0.0;
            FlareInfo[i][fZ]=0.0;
            DestroyObject(FlareInfo[i][fObject]);
  	    }
	}
    return 0;
}
I still don't got a scripter for my RP server, so I do it by myself, but as this doesn't work, I asked for help


Greets,
Bradleyornot


Re: Error 001: Expected token: ";" but found "return" - Daniel100262 - 29.06.2014

So, try:

CMD:destroyallflares(playerid, params[])
{
if(!IsACop(playerid))
{
return SendClientMessage(playerid,COLOR_GREY," You cannot use this command !");
}
if(IsACop(playerid))
{
if(PlayerInfo[playerid][pRank] < 6)
{
return SendClientMessage(playerid,COLOR_GREY," Your rank is too low to be removing flares !");
}
}
else
{
if(PlayerInfo[playerid][pRank] < 5)
{
return SendClientMessage(playerid,COLOR_GREY," Your rank is too low to be removing flares !");
}
}
DeleteAllFlare();
return 1; //THIS LINE
}

should solve your problem


Re: Error 001: Expected token: ";" but found "return" - bradleyofniet - 29.06.2014

Wow.... So stupid, I forgot the ; behind the Deleteallflare function, *Facepalm*
Thanks mate


Re: Error 001: Expected token: ";" but found "return" - Daniel100262 - 29.06.2014

Happens friend, success in your gamemode haha


Re: Error 001: Expected token: ";" but found "return" - bradleyofniet - 29.06.2014

Thanks :P