Need help regarding /admins and few other stuffs. [rep] -
[UE]Milan - 01.11.2015
So Firstly, The /admins.
When a player types in /admins, The online admins are shown but, Even tho an admin level is 2, It is shown as 5. 5 is the max. admin level. Example:
Raymond promotes John to level 2 admin. Player 1, Checks the admins online with the command /admins, He sees that John is level 5 even though his real level is 2. Although, John has access only to level 2 admin commands.
Here is the /admins code:
Код HTML:
COMMAND:admins(playerid, params[])
{
new str[128];
SendClientMessage(playerid, WHITE, "-------------------------");
SendClientMessage(playerid, RED, "Online Admins:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerStat[i][AdminLevel] >= 1)
{
format(str, sizeof(str), "%s, Level %d admin.", GetOOCName(i), PlayerStat[playerid][AdminLevel]);
SendClientMessage(playerid, RED, str);
}
}
SendClientMessage(playerid, WHITE, "-------------------------");
return 1;
}
==============================================
I need a small script where when a player presses "F" key to enter or exit a door, It should freeze the Player for a few secs for the Interior to load. Since I use a custom mapped Prison, It takes a while for the players to get the map loaded. Usually players fall down.
PS: I'm kindda new to scripting, So a detailed answer would help me alot.
Re: Need help regarding /admins and few other stuffs. [rep] -
itsCody - 01.11.2015
you can try
PHP код:
COMMAND:admins(playerid, params[])
{
new staffcount, string[128];
SendClientMessage(playerid, WHITE, "-------------------------");
SendClientMessage(playerid, RED, "Online Admins:");
foreach(new i : Player)
{
if(!(1 <= PlayerStat[i][AdminLevel] <= 3)) continue;
format(string, sizeof(string), "%s%i) %s (Level %i)", string, ++staffcount, GetOOCName(i), PlayerStat[i][AdminLevel]);
}
if(!staffcount)
{
SendClientMessage(playerid, RED, "No admins online");
return 1;
}
else { SendClientMessage(playerid, RED, string); }
SendClientMessage(playerid, WHITE, "-------------------------");
return true;
}
I'm using foreach for the loop, if you don't want it use
PHP код:
COMMAND:admins(playerid, params[])
{
new staffcount, string[128];
SendClientMessage(playerid, WHITE, "-------------------------");
SendClientMessage(playerid, RED, "Online Admins:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!(1 <= PlayerStat[i][AdminLevel] <= 3)) continue;
format(string, sizeof(string), "%s%i) %s (Level %i)", string, ++staffcount, GetOOCName(i), PlayerStat[i][AdminLevel]);
}
}
if(!staffcount)
{
SendClientMessage(playerid, RED, "No admins online");
return 1;
}
else { SendClientMessage(playerid, RED, string); }
SendClientMessage(playerid, WHITE, "-------------------------");
return true;
}
I don't know your maximum admin level so change the <= 3 to match it.
Re: Need help regarding /admins and few other stuffs. [rep] -
jlalt - 01.11.2015
PHP код:
MAND:admins(playerid, params[])
{
new str[128];
SendClientMessage(playerid, WHITE, "-------------------------");
SendClientMessage(playerid, RED, "Online Admins:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerStat[i][AdminLevel] >= 1)
{
format(str, sizeof(str), "%s, Level %d admin.", GetOOCName(i), PlayerStat[i][AdminLevel]);
SendClientMessage(playerid, RED, str);
}
}
SendClientMessage(playerid, WHITE, "-------------------------");
return 1;
}
in playerstats you used playerid it gonna check your own level not who is admin level
now it should work