SA-MP Forums Archive
Errors - 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: Errors (/showthread.php?tid=246997)



Errors - nuriel8833 - 07.04.2011

I copied this code from another mode:
PHP код:
    for(new i=0;i<MAX_PLAYERS;i++)
    {
    switch(
reason)
    {
    case 
0; {
    
format(Stringsizeof(String), "%s has left the server. (Crash)"playername);
    
SendClientMessage(i,COLOR_JGREYString); }
    case 
1; {
    
format(Stringsizeof(String), "%s has left the server. (Leaving)"playername);
    
SendClientMessage(i,COLOR_JGREYString); }
    case 
2; {
    
format(Stringsizeof(String), "%s has left the server. (Kicked/Banned)"playername);
    
SendClientMessage(i,COLOR_JGREYString); }
    } } 
But when I put it on my server,I get those errors:
PHP код:
C:\Documents and Settings\XXX\XXX\XXX\XXX\XXX.pwn(984) : error 001expected token":"but found ";"
C:\Documents and Settings\XXX\XXX\XXX\XXX\XXX.pwn(984) : error 036: empty statement
C
:\Documents and Settings\XXX\XXX\XXX\XXX\XXX.pwn(987) : error 014invalid statementnot in switch
C:\Documents and Settings\XXX\XXX\XXX\XXX\XXX.pwn(987) : warning 215expression has no effect
C
:\Documents and Settings\XXX\XXX\XXX\XXX\XXX.pwn(989) : error 017undefined symbol "i"
C:\Documents and Settings\XXX\XXX\XXX\XXX\XXX.pwn(990) : error 014invalid statementnot in switch
C:\Documents and Settings\XXX\XXX\XXX\XXX\XXX.pwn(990) : warning 215expression has no effect
C
:\Documents and Settings\XXX\XXX\XXX\XXX\XXX.pwn(992) : error 017undefined symbol "i"
C:\Documents and Settings\XXX\XXX\XXX\XXX\XXX.pwn(993) : error 054unmatched closing brace ("}")
C:\Documents and Settings\XXX\XXX\XXX\XXX\XXX.pwn(995) : error 010invalid function or declaration 
What is wrong?


Re: Errors - BMUK - 07.04.2011

It's case 0: - not case 0;

The first error couldnt be any clearer tbh.


Re: Errors - nuriel8833 - 07.04.2011

Quote:
Originally Posted by BMUK
Посмотреть сообщение
It's case 0: - not case 0;

The first error couldnt be any clearer tbh.
Oops :P
I haven't noticed that,I changed everything to : and all the errors are gone
tyvm