check all online players for a skin - 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: check all online players for a skin (
/showthread.php?tid=429368)
check all online players for a skin -
NicholasA - 09.04.2013
So when i enter /check
i want it to check all online players if they got skin 1, how can i do this? thanks!
Re: check all online players for a skin -
Isolated - 09.04.2013
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;
}
Re: check all online players for a skin -
Konstantinos - 09.04.2013
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!