Commands problem - 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: Commands problem (
/showthread.php?tid=397468)
Commands problem -
Devilxz97 - 05.12.2012
hey guys , i have problem here
/admins cmd not show an other admin online
example;
if there is 5 admin online , do /admins , it will just show 1 admins online lol its weird :\
pawn Код:
CMD:admins(playerid, params[])
{
for(new i = 0; i <MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdmin] > 0)
{
new str[1000];
new Admin[MAX_PLAYER_NAME];
GetPlayerName(i, Admin, sizeof(Admin));
SendClientMessage(playerid, lightgreen, "----[{B4B5B7}0NLINE ADMIN{9ACD32}]----");
format(str, sizeof(str), "[Admin]'%s - level %d", Admin, PlayerInfo[i][pAdmin]);
SendClientMessage(playerid, grey, str);
Count++;
}
}
if(Count == 0)
{
SendClientMessage(playerid, lightred, "[System]: No Admin Online!");
}
return 1;
}
Re: Commands problem -
maramizo - 05.12.2012
Where's your definition of "Count"?
Re: Commands problem -
Devilxz97 - 05.12.2012
i have it already , i put it at the top of script .
Re: Commands problem -
maramizo - 05.12.2012
Here's another way to get to it:
pawn Код:
CMD:admins(playerid, params[])
{
new string[128], count;
foreach(Player, i)
{
if(PlayerInfo[i][pAdmin] > 0)
{
SendClientMessage(playerid, lightgreen, "----[{B4B5B7}0NLINE ADMIN{9ACD32}]----");
new adminname[MAX_PLAYER_NAME];
GetPlayerName(i, adminname, MAX_PLAYER_NAME);
format(string, sizeof(string), "[Admin]'%s - level %d", adminname, PlayerInfo[i][pAdmin]);
SendClientMessage(playerid, grey, string);
count++;
}
}
if(!count)
{
return SendClientMessage(playerid, lightred, "[System]: No Admin Online!");
}
else
{
return SendClientMessage(playerid, lightgreen, "--------------------------------------");
}
}
Using foreach include.
Re: Commands problem -
Devilxz97 - 05.12.2012
k let me try