give everyone something
#1

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.
Reply
#2

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

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

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;
}
Reply
#5

Farsek, eror
Reply
#6

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

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

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;
}
Reply
#8

Thanks, +rep for you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)