SA-MP Forums Archive
/admins help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /admins help (/showthread.php?tid=240967)



/admins help - tanush - 17.03.2011

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;
}



Re: /admins help - tanush - 17.03.2011

help pls?


Re: /admins help - [WF]Demon - 17.03.2011

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;
}



Re: /admins help - Marricio - 17.03.2011

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..


Re: /admins help - [WF]Demon - 17.03.2011

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.


Re: /admins help - Tee - 17.03.2011

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


Re: /admins help - Marricio - 17.03.2011

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


Re: /admins help - THE_KNOWN - 17.03.2011

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


Re: /admins help - Tee - 17.03.2011

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?


Re: /admins help - THE_KNOWN - 17.03.2011

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