SA-MP Forums Archive
Need help regarding /admins and few other stuffs. [rep] - 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: Need help regarding /admins and few other stuffs. [rep] (/showthread.php?tid=593037)



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(playeridparams[])
{
    new 
staffcountstring[128];
    
SendClientMessage(playeridWHITE"-------------------------");
    
SendClientMessage(playeridRED"Online Admins:");
    foreach(new 
Player)
    {
        if(!(
<= PlayerStat[i][AdminLevel] <= 3)) continue;
        
format(stringsizeof(string), "%s%i) %s (Level %i)"string, ++staffcountGetOOCName(i), PlayerStat[i][AdminLevel]);
    }
    if(!
staffcount)
    {
        
SendClientMessage(playeridRED"No admins online");
        return 
1;
    }
    else { 
SendClientMessage(playeridREDstring); }
    
SendClientMessage(playeridWHITE"-------------------------");
    return 
true;

I'm using foreach for the loop, if you don't want it use

PHP код:
COMMAND:admins(playeridparams[])
{
    new 
staffcountstring[128];
    
SendClientMessage(playeridWHITE"-------------------------");
    
SendClientMessage(playeridRED"Online Admins:");
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(!(
<= PlayerStat[i][AdminLevel] <= 3)) continue;
            
format(stringsizeof(string), "%s%i) %s (Level %i)"string, ++staffcountGetOOCName(i), PlayerStat[i][AdminLevel]);
        }
    }
    if(!
staffcount)
    {
        
SendClientMessage(playeridRED"No admins online");
        return 
1;
    }
    else { 
SendClientMessage(playeridREDstring); }
    
SendClientMessage(playeridWHITE"-------------------------");
    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(playeridparams[])
{
    new 
str[128];
    
SendClientMessage(playeridWHITE"-------------------------");
    
SendClientMessage(playeridRED"Online Admins:");
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i) && PlayerStat[i][AdminLevel] >= 1)
        {
            
format(strsizeof(str), "%s, Level %d admin."GetOOCName(i), PlayerStat[i][AdminLevel]);
            
SendClientMessage(playeridREDstr);
        }
    }
    
SendClientMessage(playeridWHITE"-------------------------");
    return 
1;

in playerstats you used playerid it gonna check your own level not who is admin level now it should work