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



functions problem - Face9000 - 21.01.2011

Hi all,i've this code in my gm.

pawn Код:
for(new i=0; i<=MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)) SavePlayer(i) SavePlayerVip(i);;
    }
1st is to save player stats and 2nd is to save vip players.

But i get this:

error 001: expected token: ";", but found "-identifier-"
error 036: empty statement


Re: functions problem - ExeC - 21.01.2011

[QUOTE=Logitech90;1029002]Hi all,i've this code in my gm.

pawn Код:
for(new i=0; i<=MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)) SavePlayer(i) SavePlayerVip(i);;
    }
Ah, remove ";" from the end...


Re: functions problem - Face9000 - 21.01.2011

Yes,already tried

But i get:

error 001: expected token: ";", but found "-identifier-"


Re: functions problem - ExeC - 21.01.2011

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i)) SavePlayer(i) SavePlayerVip(i);
}
Not sure, try.


Re: functions problem - Mike Garber - 21.01.2011

pawn Код:
for(new i=0; i<=MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        SavePlayer(i);
        SavePlayerVip(i);
    }
}
GOD DAMNIT the indentation is fucked up by the forums
Edit: There we go


Re: functions problem - Face9000 - 21.01.2011

Same :S

Edit: I fixed with Mike's code,thanks.


Re: functions problem - Sascha - 21.01.2011

ok guys here is a basic structure thing of coding languages...
in case you are using an "if" you have to define the beginning and the end of this check.
In case there is only one thing that should be done after the if you can write it straight behind...
e.g.:
pawn Код:
if(IsPlayerConnect(playerid)) SendClientMessage(playerid, 0x999999AA, "You are a noob");
but if there is more than 1 thing to be executed, you have to define the beginning and the end by using { and } in pwn...
like:
pawn Код:
if(IsPlayerConnected(playerid))
{
    SendClientMessage(playerid, 0x999999AA, "You are a noob");
    Kick(playerid);
}