check all online players for a skin
#1

So when i enter /check
i want it to check all online players if they got skin 1, how can i do this? thanks!
Reply
#2

Okay, you need to change the string size, and the PlayerInfo

pawn Код:
CMD:check(playerid, params)
{
    if(PlayerInfo[playerid][pAdmin] >= 1) // CHANGE THIS.
    {
        for(new i = 0; i < MAX_PLAYERS; i ++)
        {
            if(GetPlayerSkin(i) == 1)
            {
                new String[128], Name[MAX_PLAYER_NAME];
                GetPlayerName(i, Name, MAX_PLAYER_NAME);
                format(String, sizeof(String), "%s has skin id 1", Name);
                SendClientMessage(playerid, -1, String);
            }
        }
    }
    return 1;
}
Reply
#3

Atleast, you need to check whether the playerid is online or not. It's better to use foreach as it loops through the connected players and it's faster that old for loop method!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)