SA-MP Forums Archive
[SOLVED] The command doesn't give everyone a point! - 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: [SOLVED] The command doesn't give everyone a point! (/showthread.php?tid=142093)



[SOLVED] The command doesn't give everyone a point! - XRVX - 16.04.2010

pawn Code:
dcmd_pointall(playerid,params[])
{
    #pragma unused params
    if(AccData[playerid][Level]>=4)
    {
        for(new x=0; x<MAX_PLAYERS; x++)
        {
            Points[x]++;
            new po[MAX_PLAYER_NAME+45];
            format(po,sizeof(po),"* Admin %s (ID:%d) gave everyone a point!",PlayerName(playerid),playerid);
            SendClientMessageToAll(COLOR_LIGHTGREEN,po);
            GameTextForAll("~g~Free points~n~for everyone!",3000,5);
            return 1;
        }
    }
    return 1;
}


No errors or warning, but noone gets the points


Re: The command doesn't give everyone a point! - AK47317 - 17.04.2010

is it a point or a score?


Re: The command doesn't give everyone a point! - mansonh - 17.04.2010

You exited in your for loop, meaning you only did player 0 then exited.

You also tried to send a client message to all players, for every player in the loop.


pawn Code:
dcmd_pointall(playerid,params[])
{
    #pragma unused params
    if(AccData[playerid][Level]>=4)
    {
        new po[MAX_PLAYER_NAME+45];
        format(po,sizeof(po),"* Admin %s (ID:%d) gave everyone a point!",PlayerName(playerid),playerid);
        SendClientMessageToAll(COLOR_LIGHTGREEN,po);
        GameTextForAll("~g~Free points~n~for everyone!",3000,5);
        for(new x=0; x<MAX_PLAYERS; x++)
        {
            Points[x]++;   
        }

    }
    return 1;
}