30.09.2018, 10:58
PHP код:
UserName(p){
new s[24];
GetPlayerName(pid,s,24);
return s;
}
UserFile(p){
new s[90];
format(s,90,"users/%s.ini",UserName(p));
return s;
}
new AdminRank[][]={"","Админ ниво [ 1 ]","Админ ниво [ 2 ]","Админ ниво [ 3 ]","Админ ниво [ 4 ]","[ Гл.Администратор ]","[ Заместник-началник ]",
"[ Собственик ]"};
enum {
dialog_admins
};
CMD:admins(pid) {
new bs[1024],
adminlvl;
foreach(new i : Player){
adminlvl=dini_Int(UserFile(i),"Admin");
if(!adminlvl)continue;
format(bs,1024,"%s%s / %s / %d\n",bs,AdminRank[adminlvl],UserName(i),i);
}
ShowPlayerDialog(pid, dialog_admins, DIALOG_STYLE_MSGBOX, "Онлайн Администратори", bs, "ОК","");
return 1;
}
when you use admin ranks, its samrter to create array of rank names
when character connects with server, load their admin ranks and other things into array
you dont need to check on cmd is player connected
use ysi foreach for looping throw players, because its the fastest and smartest way to do it.
and use this include https://sampforum.blast.hk/showthread.php?tid=481257 what can save memory