/admins help
#1

Well i made that if it shows admin is level 1 on /admins it will say "name Level 1 (server moderator)" but i got a problem it only shows "name level 1" how do i make it show Server mod beside it??
pawn Код:
CMD:admins(playerid, params[])
{
    new AdminRank[30];
    switch (PlayerData[playerid][AdminLevel])
    {
    case 0: format(AdminRank, 30, "(Server Moderator)");
    case 1: format(AdminRank, 30, "(Global Moderator)");
    case 2: format(AdminRank, 30, "(Administrator)");
    case 3: format(AdminRank, 30, "(Server Owner)");
    }
    SendClientMessage(playerid,0xFF9900AA, ".: Admin's Online!! :.");
    new name[MAX_PLAYER_NAME], string[256];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    format(string, sizeof(string), "%s Level %d %s",name,PlayerData[playerid][AdminLevel],AdminRank);
    SendClientMessage(playerid,0xFF9900AA,string);
    return 1;
}
Reply
#2

help pls?
Reply
#3

first of all do not bump your topic after 1 hour, read the rules.

pawn Код:
CMD:admins(playerid, params[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
     if(IsPlayerConnected(i))
    {
        if(PlayerData[i][AdminLevel] != 0)
        {
            SendClientMessage(playerid,0xFF9900AA, ".: Admin's Online!! :.");
            new name[MAX_PLAYER_NAME], string[256];
            GetPlayerName(i,name,MAX_PLAYER_NAME);
            if(PlayerData[i][AdminLevel] == 1) format(string, sizeof(string), "%s Level %d (Server Moderator)",name,PlayerData[playerid][AdminLevel]);
            if(PlayerData[i][AdminLevel] == 2) format(string, sizeof(string), "%s Level %d (Global Moderator)",name,PlayerData[playerid][AdminLevel]);
            if(PlayerData[i][AdminLevel] == 3) format(string, sizeof(string), "%s Level %d (Administrator)",name,PlayerData[playerid][AdminLevel]);
            if(PlayerData[i][AdminLevel] == 4) format(string, sizeof(string), "%s Level %d (Server Owner)",name,PlayerData[playerid][AdminLevel]);
        SendClientMessage(playerid,0xFF9900AA,string);
        }
    }
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by [WF]Demon
Посмотреть сообщение
first of all do not bump your topic after 1 hour, read the rules.

pawn Код:
CMD:admins(playerid, params[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
     if(IsPlayerConnected(i))
    {
        if(PlayerData[i][AdminLevel] != 0)
        {
            SendClientMessage(playerid,0xFF9900AA, ".: Admin's Online!! :.");
            new name[MAX_PLAYER_NAME], string[256];
            GetPlayerName(i,name,MAX_PLAYER_NAME);
            if(PlayerData[i][AdminLevel] == 1) format(string, sizeof(string), "%s Level %d (Server Moderator)",name,PlayerData[playerid][AdminLevel]);
            if(PlayerData[i][AdminLevel] == 2) format(string, sizeof(string), "%s Level %d (Global Moderator)",name,PlayerData[playerid][AdminLevel]);
            if(PlayerData[i][AdminLevel] == 3) format(string, sizeof(string), "%s Level %d (Administrator)",name,PlayerData[playerid][AdminLevel]);
            if(PlayerData[i][AdminLevel] == 4) format(string, sizeof(string), "%s Level %d (Server Owner)",name,PlayerData[playerid][AdminLevel]);
        SendClientMessage(playerid,0xFF9900AA,string);
        }
    }
    }
    return 1;
}
If there is more than 1 admin only will show 1 admin..
Reply
#5

Quote:
Originally Posted by Marricio
Посмотреть сообщение
If there is more than 1 admin only will show 1 admin..
What? No it loops through all players, If they are connected it checks if they have an admin level, if they do it formats their level and name, you are false.
Reply
#6

Demon your code fails. PlayerData[playerid][AdminLevel] will get the admin level of the player who typed.
Reply
#7

Quote:
Originally Posted by [WF]Demon
Посмотреть сообщение
first of all do not bump your topic after 1 hour, read the rules.

pawn Код:
CMD:admins(playerid, params[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
     if(IsPlayerConnected(i))
    {
        if(PlayerData[i][AdminLevel] != 0)
        {
            SendClientMessage(playerid,0xFF9900AA, ".: Admin's Online!! :.");
            new name[MAX_PLAYER_NAME], string[256];
            GetPlayerName(i,name,MAX_PLAYER_NAME);
            if(PlayerData[i][AdminLevel] == 1) format(string, sizeof(string), "%s Level %d (Server Moderator)",name,PlayerData[playerid][AdminLevel]);
            if(PlayerData[i][AdminLevel] == 2) format(string, sizeof(string), "%s Level %d (Global Moderator)",name,PlayerData[playerid][AdminLevel]);
            if(PlayerData[i][AdminLevel] == 3) format(string, sizeof(string), "%s Level %d (Administrator)",name,PlayerData[playerid][AdminLevel]);
            if(PlayerData[i][AdminLevel] == 4) format(string, sizeof(string), "%s Level %d (Server Owner)",name,PlayerData[playerid][AdminLevel]);
        SendClientMessage(playerid,0xFF9900AA,string);
        }
    }
    }
    return 1;
}
Quote:
Originally Posted by Tee
Посмотреть сообщение
Demon your code fails. PlayerData[playerid][AdminLevel] will get the admin level of the player who typed.
But if you notice he didn't did a loop, so he cant put i
Reply
#8

Off Topic:
tee can you join my server gotta talk to you -.-
Reply
#9

And no need to loop through the players to get the level and still format a string to get level, the string should only contain the name.

pawn Код:
CMD:admins(playerid, params[])
{
    new count = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    if(IsPlayerConnected(i))
    {
        if(PlayerData[i][AdminLevel] != 0)
        {
            SendClientMessage(playerid,0xFF9900AA, ".: Admin's Online!! :.");
            new name[MAX_PLAYER_NAME], string[256];
            GetPlayerName(i,name,MAX_PLAYER_NAME);
            if(PlayerData[i][AdminLevel] == 1) format(string, sizeof(string), "%s Level 1(Server Moderator)",name);
            if(PlayerData[i][AdminLevel] == 2) format(string, sizeof(string), "%s Level 2(Global Moderator)",name);
            if(PlayerData[i][AdminLevel] == 3) format(string, sizeof(string), "%s Level 3 (Administrator)",name,);
            if(PlayerData[i][AdminLevel] == 4) format(string, sizeof(string), "%s Level 4(Server Owner)",name);
            SendClientMessage(playerid,0xFF9900AA,string);
            count ++;
        }
        format(string,sizeof(string),"Total admins online: %i",count);
        SendClientMessage(playerid,0xFF9900AA,string);
    }
    return 1;
}
IP?
Reply
#10

eesh.zapto.org (even though its a url it still acts as a ip)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)