Help Block admin
#1

So I have this Rank code and I wanted to block the admins from being in it and leaving it just for players, but I have no ideas on how to do it.
Can someone help me?

Here is the command
pawn Код:
if (!strcmp("/toplevel", cmdtext, true)) return Rank(playerid);
code:
pawn Код:
forward Rank(playerid);
public Rank(playerid)
{
    new
        playerScores[MAX_PLAYERS][rankingEnum],
        index
    ;
    for(new i; i != MAX_PLAYERS; ++i)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
            playerScores[index][player_Score] = GetPlayerScore(i);
            playerScores[index++][player_ID] = i;
        }
    }
    GetPlayerHighestScores(playerScores, 0, index);
    new
        score_Text[1000] = "",
        player_Name[MAX_PLAYER_NAME]
    ;
    for(new i; i < 5; ++i)
    {
          if(i < index)
          {
                GetPlayerName(playerScores[i][player_ID], player_Name, sizeof(player_Name));
                format(score_Text, sizeof(score_Text), "%s\n{FFFFFF}» {00A600}%dє{FFFFFF} Top -> {0CC6F5}%s {FFFFFF}- Level {00A600}%d", score_Text, i + 1, player_Name, playerScores[i][player_Score]);
          }
          else
          {
                format(score_Text, sizeof(score_Text), "%s\n{FFFFFF}» {FF0000}%dє{FFFFFF} Top ->  {FFB85C}No one", score_Text, i + 1);
          }
    }
    ShowPlayerDialog(playerid, 2742, DIALOG_STYLE_MSGBOX, "{FFFFFF}Top 5{00A600} Level", score_Text, "Fechar", "");
    return true;
}
My admin variable
pawn Код:
pAdmin[playerid] == 6
Reply
#2

PHP код:
forward Rank(playerid);
public 
Rank(playerid)
{
    new
           
playerScores[MAX_PLAYERS][rankingEnum],
        
index
    
;
    for(new 
i!= MAX_PLAYERS; ++i)
    {
          if(
IsPlayerConnected(i) && !IsPlayerNPC(i) && pAdmin[i] == 0)
          {
            
playerScores[index][player_Score] = GetPlayerScore(i);
            
playerScores[index++][player_ID] = i;
        }
    }
    
GetPlayerHighestScores(playerScores0index);
    new
          
score_Text[1000] = "",
        
player_Name[MAX_PLAYER_NAME]
    ;
    for(new 
i5; ++i)
    {
           if(
index)
          {
                
GetPlayerName(playerScores[i][player_ID], player_Namesizeof(player_Name));
                 
format(score_Textsizeof(score_Text), "%s\n{FFFFFF}» {00A600}%dє{FFFFFF} Top -> {0CC6F5}%s {FFFFFF}- Level {00A600}%d"score_Text1player_NameplayerScores[i][player_Score]);
          }
          else
          {
                
format(score_Textsizeof(score_Text), "%s\n{FFFFFF}» {FF0000}%dє{FFFFFF} Top ->  {FFB85C}No one"score_Text1);
          }
       }
       
ShowPlayerDialog(playerid2742DIALOG_STYLE_MSGBOX"{FFFFFF}Top 5{00A600} Level"score_Text"Fechar""");
     return 
true;

Reply
#3

that is a very confusing post but from what i comprehended i'm thinking that u want to make admins prohibited to use that command? if so do this:
PHP код:
if (!strcmp("/toplevel"cmdtexttrue)) 
{
    if(
pAdmin[playerid] >=1) return 0;  
    
Rank(playerid);
    return 
1;

Reply
#4

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
that is a very confusing post but from what i comprehended i'm thinking that u want to make admins prohibited to use that command? if so do this:
PHP код:
if (!strcmp("/toplevel"cmdtexttrue)) 
{
    if(
pAdmin[playerid] >=1) return 0;  
    
Rank(playerid);
    return 
1;

No, I want to make administrators not appear in rank and thus giving making the dispute between players get more competitive.
Reply
#5

Quote:
Originally Posted by Geremias1533
Посмотреть сообщение
No, I want to make administrators not appear in rank and thus giving making the dispute between players get more competitive.
Ajax already posted the thing you need.

@AjaxM credits:
PHP код:
forward Rank(playerid);
public 
Rank(playerid)
{
    new
           
playerScores[MAX_PLAYERS][rankingEnum],
        
index
    
;
    for(new 
i!= MAX_PLAYERS; ++i)
    {
          if(
IsPlayerConnected(i) && !IsPlayerNPC(i) && pAdmin[i] == 0)
          {
            
playerScores[index][player_Score] = GetPlayerScore(i);
            
playerScores[index++][player_ID] = i;
        }
    }
    
GetPlayerHighestScores(playerScores0index);
    new
          
score_Text[1000] = "",
        
player_Name[MAX_PLAYER_NAME]
    ;
    for(new 
i5; ++i)
    {
           if(
index)
          {
                
GetPlayerName(playerScores[i][player_ID], player_Namesizeof(player_Name));
                 
format(score_Textsizeof(score_Text), "%s\n{FFFFFF}» {00A600}%dє{FFFFFF} Top -> {0CC6F5}%s {FFFFFF}- Level {00A600}%d"score_Text1player_NameplayerScores[i][player_Score]);
          }
          else
          {
                
format(score_Textsizeof(score_Text), "%s\n{FFFFFF}» {FF0000}%dє{FFFFFF} Top ->  {FFB85C}No one"score_Text1);
          }
       }
       
ShowPlayerDialog(playerid2742DIALOG_STYLE_MSGBOX"{FFFFFF}Top 5{00A600} Level"score_Text"Fechar""");
     return 
true;

Reply
#6

Quote:
Originally Posted by Geremias1533
Посмотреть сообщение
No, I want to make administrators not appear in rank and thus giving making the dispute between players get more competitive.
The code AJax posted works, have fun
Reply
#7

Oh, OK. Thank you for your help!
+ RPs
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)