admins command - 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 command (
/showthread.php?tid=468169)
admins command -
Superhot - 06.10.2013
Код:
CMD:admins(playerid) {
SendClientMessage(playerid,-1, "_________|- Las Venturas Gang Wars Online Admins -|_________");
static
playername[25],
string[80],
i;
for(i = (GetMaxPlayers() - 1); i > -1; --i) {
if(PlayerInfo[i][Level]) {
GetPlayerName(i, playername, sizeof playername);
switch(PlayerInfo[i][Level]) {
case 1: string = "Moderator";
case 2: string = "Administrator";
case 3: string = "Junior Admin";
case 4: string = "Senior Admin";
case 5: string = "Head Admin";
case 6: string = "Mapper";
case 7: string = "Scripter";
case 8: string = "Owner";
}
format(string, sizeof string, "%s - %s", playername, string);
SendClientMessage(playerid, red, string);
}
}
return 1;
}
I want to add, If server has 0 admins online, I want to send a message saying: No online admins at the moment.
and remove SendClientMessage(playerid,-1, "_________|- Las Venturas Gang Wars Online Admins -|_________");
And I want format(string, sizeof string, "%s - Level: %S %s", playername, level, string);
but it say undefined sysmbol: level
Re: admins command - Patrick - 06.10.2013
Here you go!
pawn Код:
CMD:admins(playerid)
{
static
playername[ 25 ],
string[ 80 ],
countadmins
;
SendClientMessage(playerid,-1, "_________|- Las Venturas Gang Wars Online Admins -|_________");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
if(PlayerInfo[i][Level])
{
GetPlayerName(i, playername, sizeof playername);
switch(PlayerInfo[i][Level])
{
case 1: string = "Moderator";
case 2: string = "Administrator";
case 3: string = "Junior Admin";
case 4: string = "Senior Admin";
case 5: string = "Head Admin";
case 6: string = "Mapper";
case 7: string = "Scripter";
case 8: string = "Owner";
}
format(string, sizeof string, "%s - %s", playername, string);
countadmins ++;
}
SendClientMessage(playerid, red, string);
if(countadmins == 0) SendClientMessage(playerid, -1, "No Admins Online" );
}
return 1;
}