Help me for admins cmd - 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: Help me for admins cmd (
/showthread.php?tid=629778)
Help me for admins cmd -
TOS - 03.03.2017
Код:
CMD:admins(playerid, params[])
{
if(AccountInfo[playerid][pAdmin] > 0)
{
new adminstring[128];
if(IsPlayerConnected(playerid))
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(AccountInfo[playerid][pAdmin] > 0)
{
format(adminstring, sizeof(adminstring),"%s%s: %s\n", adminstring, GetAdminName(i), PlayerName(i));
}
}
}
ShowPlayerDialog(playerid,DIALOG_ADMINS,DIALOG_STYLE_MSGBOX,"Online admins",adminstring,"Close","");
}
else return SendClientMessage(playerid,-1,"*"COL_LGREEN" No admins online");
Re: Help me for admins cmd -
RedRex - 03.03.2017
Can you post the ERRORS/Warrings?
Respuesta: Help me for admins cmd -
mcreed - 04.03.2017
Try
PHP код:
CMD:admins(playerid, params[])
{
new infDialogo[256], fTexto[126];
if(AccountInfo[playerid][pAdmin] > 0)
{
for(new i = 0; i < GetPlayerPoolSize(); i++)
{
if(IsPlayerConnected(i))
{
if(AccountInfo[i][pAdmin] > 0)
{
format(fTexto, sizeof(fTexto), "%s: %s\n", GetAdminName(i), PlayerName(i));
strcat(infDialogo, fTexto);
}
}
if(i == GetPlayerPoolSize()-1)
{
if(strlen(fInfDialogo) == 0)
return SendClientMessage(playerid, -1, "*"COL_LGREEN" No admins online");
}
}
ShowPlayerDialog(playerid,DIALOG_ADMINS,DIALOG_STYLE_MSGBOX,"Online admins",infDialogo,"Close","");
}
return true;
}
Re: Help me for admins cmd -
TOS - 04.03.2017
bump bump
Re: Help me for admins cmd -
Toroi - 04.03.2017
What is your problem? Do you get errors? Is some part of the function not doing what it should do?
Re: Help me for admins cmd -
Sabur - 04.03.2017
Maybe try this code:
PHP код:
CMD:admins(playerid, params[])
{
new count, string[144];
for(new i = 0; i < GetPlayerPoolSize(); i++)
{
if(AccountInfo[playerid][pAdmin] > 0)
{
format(string, sizeof(string), "%s: %s\n", GetAdminName(i), PlayerName(i));
count++;
}
}
if(!count)
return SendClientMessage(playerid, -1, "*"COLOR_LGREEN" No admins online");
ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_MSGBOX, "Online admins", string, "Close", "");
return 1;
}
Re: Help me for admins cmd -
JessThompson - 04.03.2017
*Rubs magic ball* Please find me what is wrong with TOS's command
ERROR 102: You are not a wizard harry