/admins in dialog - 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: /admins in dialog (
/showthread.php?tid=659047)
/admins in dialog -
TaligaroW - 21.09.2018
Hello everyone,i have /admins command that shows online admins in chat,but i want to make it to be in dialog
Here's my command
PHP код:
CMD:admins(playerid,params[])
{
SendClientMessage(playerid,COLOR_RED,"**____________VORTEX-SAMP ADMINS____________**");
new j;
j = GetPlayerPoolSize();
for(new id=0;id<=j;id++)
{
GetPlayerName(id,name,sizeof(name));
format(iname,sizeof(iname),"%s.ini",name);
if(dini_Int(iname,"Admin")!=0)
{
new str[MAX_PLAYER_NAME+100];
format(str,sizeof(str),"Ник: {00FF00}%s {FF0000}Админ Ниво: {FFFF00}%d",name,dini_Int(iname,"Admin"));
SendClientMessage(playerid,COLOR_ORANGE,str);
}
}
return 1;
}
So i want to make this command to show online admins in dialog(the non selectable dialog).
I'll be really thankful if anyone help me!
Re: /admins in dialog -
DeMoo - 21.09.2018
maybe like this?
PHP код:
CMD:admins(playerid, params[])
{
new string[1024],string1[512],total = 0;
foreach(new i : Player)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] > 1)
{
new admin[20];
if(PlayerInfo[i][pAdmin] == 1) { admin = "Admin"; }
else if(PlayerInfo[i][pAdmin] == 2) { admin = "Moderator"; }
else if(PlayerInfo[i][pAdmin] == 3) { admin = "Administrator"; }
else if(PlayerInfo[i][pAdmin] == 4) { admin = "Main Administrator"; }
else if(PlayerInfo[i][pAdmin] == 5) { admin = "Developer"; }
if(PlayerInfo[i][pAdmin] >= 1 ) total++;
new sendername[MAX_PLAYER_NAME];
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 1024, "%s\n{00CCFF}%s: {FFFFFF}%s (ID: %d) Status:{00ff00} Online",string, admin, sendername, i);
}
}
}
format(string1,512,"Admins Online: {ff3300}%d",total);
ShowPlayerDialog(playerid, 65535, DIALOG_STYLE_MSGBOX, string1, string, "Close", "");
return 1;
}
Re: /admins in dialog -
CaptainBoi - 21.09.2018
PHP код:
playername(playerid)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
return pname;
}
CMD:admins(playerid)
{
new count = 0;
new str[200];
for(new i; i<MAX_PLAYERS;i++)
{
if(MakeVariableOfAdmin[i] > 0)
{
format(str, sizeof str, "%s[%d] || Admin Level: %d\n", "Close", "", playername(i), i, MakeVariableOfAdmin[i]);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Current online Admins:", str, "", "Close");
count++;
}
}
if (count == 0) ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Current online Admins:", "No admins online\n_____________________", "Close", "");
return 1;
}
Re: /admins in dialog -
CodeStyle175 - 21.09.2018
PHP код:
new arrAdminRanks[][]={"Admin","Moderator","Moderator","Administrator","Main Administrator","Developer"};
GetUserName(p){
new s[20];
GetPlayerName(p,s,20);
return s;
}
CMD:admins(p){
new s[1024],
s2[20],
cnt;
foreach(new i : Player){
if(!PlayerInfo[i][pAdmin])continue;
cnt++;
format(s,1024,"%s%d | %s | %s\n",s,cnt,arrAdminRanks[PlayerInfo[i][pAdmin]],GetUserName(i));
}
format(s2,20,"Admins online - %d",cnt);
ShowPlayerDialog(p,d_admins,DIALOG_STYLE_MSGBOX,s2,s,"Close","");
return 1;
}
Re: /admins in dialog -
TaligaroW - 21.09.2018
thanks alot