SA-MP Forums Archive
wrong code? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: wrong code? (/showthread.php?tid=196418)



wrong code? - Face9000 - 05.12.2010

What's wrong with this respawn car code?


Код:
	   if(!strcmp(cmdtext, "/rc", true))
    {
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
         if (adminlevel[playerid] >= 5)
    	{
         SetVehicleToRespawn(i);
         new str[100];
  	     format(str,sizeof str,"0,13%s respawned all cars.",(sendername));
   	   	 IRC_GroupSay(IRC_Group, EchoChan,str);
        }
		}
		else
		SendClientMessage(playerid, RED, "You cannot use this command!");
		return 1;
	}
I got this error

Код:
C:\Documents and Settings\k\Desktop\COD5.pwn(7166) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: wrong code? - JaTochNietDan - 05.12.2010

It's because you have an else statement but there is no matching if statement!

Also please indent code for the love of god

pawn Код:
if(!strcmp(cmdtext, "/rc", true))
{
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
        if (adminlevel[playerid] >= 5)
        {
            SetVehicleToRespawn(i);
            new str[100];
            format(str,sizeof str,"0,13%s respawned all cars.",sendername);
            IRC_GroupSay(IRC_Group, EchoChan,str);
        }
        else SendClientMessage(playerid, RED, "You cannot use this command!");
    }
    return 1;
}
I believe that's what you intended


Re: wrong code? - Face9000 - 05.12.2010

Yeah,now it's working,thanks!

P.S. Yeah the ident is fucked up lol