/admins command isen't working ... - 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: /admins command isen't working ... (
/showthread.php?tid=171870)
/admins command isen't working ... -
Danny - 28.08.2010
Hello,
I have made an /admins command, that will display all admins in the game on a list. Only my problem is that it don't work. The list displays only one admin.
Код:
dcmd_admins(playerid, cmdtext[]) {
#pragma unused cmdtext
SendClientMessage(playerid, ADMINFS_MESSAGE_COLOR, "Admins online:");
new admins = 0;
new string[100];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(pInfo[i][adminlevel] == 1)
{
GetPlayerName(i, pname, sizeof(pname));
format(string, sizeof(string), "%d) Name: %s, ID: %d", admins, pname, i,(i));
SendClientMessage(playerid, COLOR_GREY, string);
admins++;
return 1;
}
}
}
if(admins == 0)
{
SendClientMessage(playerid,0xFF0000AA, "There are currently no admins online");
return 1;
}
return 1;
}
Please help me if you know the answer.
Greetz,
Danny
Re: /admins command isen't working ... -
Claude - 28.08.2010
Your code seems to be fine
Re: /admins command isen't working ... -
Calgon - 28.08.2010
Remove that from your loop, that's what kills it and results in it only submitting 1 message.
Quote:
Originally Posted by Claude
Your code seems to be fine
|
What was the point in posting if you're unable to properly evaluate it?
Re: /admins command isen't working ... -
Jochemd - 28.08.2010
pawn Код:
dcmd_admins(playerid,params[])
{
#pragma unused params
if(IsPlayerConnected(playerid))
{
new AdminGuy[MAX_PLAYER_NAME];
new string[50 + MAX_PLAYER_NAME];
SendClientMessage(playerid, COLOR_WHITE, "Current Online Admins:");
SendClientMessage(playerid, COLOR_WHITE, "__________________");
for(new i = 0; i < MAX_PLAYERS; i++)
{
new lvl = pInfo[i][adminlevel];
if(lvl > 0)
{
GetPlayerName(i, AdminGuy, sizeof(AdminGuy));
format(string, sizeof(string), "Name: %s - Admin Level: %d", AdminGuy, lvl);
SendClientMessage(playerid, COLOR_BLUE, string);
}
}
SendClientMessage(playerid, COLOR_WHITE, "___________________");
}
return 1;
}
Not tested but must work.