SA-MP Forums Archive
give everyone something - 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: give everyone something (/showthread.php?tid=279875)



give everyone something - uprp - 29.08.2011

I'm making a /givecookieall.


I have this.

PlayerInfo[GiveAll][pCookies] += 1;

What's the correct fix to give everyone a cookie using that?

Thanks.


Re: give everyone something - =WoR=Varth - 29.08.2011

pawn Код:
for(new i;i<MAX_PLAYERS;i++)
{
   PlayerInfo[i][pCookies]++;
}



Re: give everyone something - IceCube! - 29.08.2011

YOu should be using your player info and creating a loop to loop all players what are doing?


Re: give everyone something - Farsek - 29.08.2011

pawn Код:
if(strcmp(cmdtext,"/givecookieall",true) == 0)
{
    if(IsPlayerAdmin(playerid)
    {
        for(new i = 0,j = GetMaxPlayers();i<j;i++)
        {
            if(IsPlayerConnected(i))
            {
                PlayerInfo[i][pCookies] += 1;
            }
        }
        new str[128];
        new Name[25];GetPlayerName(playerid,Name,25);
        format(str, 128," Administrator %s had give to all a cookie.",Name);
        SendClientMessageToAll(~0, str);
    }
    return 1;
}



Re: give everyone something - uprp - 29.08.2011

Farsek, eror


Re: give everyone something - uprp - 29.08.2011

farsek, your command gives me an error, given {, expted )

at this line
error 001: expected token: ")", but found "{"


Re: give everyone something - Jafet_Macario - 29.08.2011

Farsek forget to put one " ) ".
pawn Код:
if(strcmp(cmdtext,"/givecookieall",true) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        for(new i = 0,j = GetMaxPlayers();i<j;i++)
        {
            if(IsPlayerConnected(i))
            {
                PlayerInfo[i][pCookies] += 1;
            }
        }
        new str[128];
        new Name[25];
        GetPlayerName(playerid,Name,25);
        format(str, 128," Administrator %s had give to all a cookie.",Name);
        SendClientMessageToAll(~0, str);
    }
    return 1;
}



Re: give everyone something - uprp - 29.08.2011

Thanks, +rep for you!