SA-MP Forums Archive
Can this be changed (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: Can this be changed (Rep+) (/showthread.php?tid=302976)



Can this be changed (Rep+) - seanny - 11.12.2011

Can this be changed so that is does not show level 1 admins, Please?

pawn Code:
CMD:admins(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Online Admins:");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(PlayerInfo[i][pAdminLevel] >= 1 && PlayerInfo[i][pAdminLevel] < 6)
                {
                    new admtext[64], sendername[MAX_PLAYER_NAME], string[128];
                    if(PlayerInfo[i][pAdminLevel] == 5) { admtext = "Server Owner"; }
                    else if(PlayerInfo[i][pAdminLevel] == 4) { admtext = "Level 4 Admin"; }
                    else if(PlayerInfo[i][pAdminLevel] == 3) { admtext = "Level 3 Admin"; }
                    else if(PlayerInfo[i][pAdminLevel] == 2) { admtext = "Level 2 Admin"; }
                    else if(PlayerInfo[i][pAdminLevel] == 1) { admtext = "Level 1 Admin"; }
                    else { admtext = "Basic Administrator"; }
                    GetPlayerName(i, sendername, sizeof(sendername));
                    sendername[strfind(sendername,"_")] = ' ';
                    if(AdminDuty[i] == 0)
                    {
                        format(string, 128, "%s: %s (Admin Duty: No)", admtext, sendername);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                    }
                    else
                    {
                        format(string, 128, "%s: %s (Admin Duty: Yes)", admtext, sendername);
                        SendClientMessage(playerid, COLOR_GREEN, string);

                    }
                }
            }
        }
    }
    return 1;
}



Re: Can this be changed (Rep+) - suhrab_mujeeb - 11.12.2011

pawn Code:
CMD:admins(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Online Admins:");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(PlayerInfo[i][pAdminLevel] >= 2 && PlayerInfo[i][pAdminLevel] < 6)
                {
                    new admtext[64], sendername[MAX_PLAYER_NAME], string[128];
                    if(PlayerInfo[i][pAdminLevel] == 5) { admtext = "Server Owner"; }
                    else if(PlayerInfo[i][pAdminLevel] == 4) { admtext = "Level 4 Admin"; }
                    else if(PlayerInfo[i][pAdminLevel] == 3) { admtext = "Level 3 Admin"; }
                    else if(PlayerInfo[i][pAdminLevel] == 2) { admtext = "Level 2 Admin"; }
                    else { admtext = "Basic Administrator"; }
                    GetPlayerName(i, sendername, sizeof(sendername));
                    sendername[strfind(sendername,"_")] = ' ';
                    if(AdminDuty[i] == 0)
                    {
                        format(string, 128, "%s: %s (Admin Duty: No)", admtext, sendername);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                    }
                    else
                    {
                        format(string, 128, "%s: %s (Admin Duty: Yes)", admtext, sendername);
                        SendClientMessage(playerid, COLOR_GREEN, string);

                    }
                }
            }
        }
    }
    return 1;
}
Untested.


Re: Can this be changed (Rep+) - Finn - 11.12.2011

Do you understand anything about PAWN?


Re: Can this be changed (Rep+) - Ash. - 11.12.2011

Quote:
Originally Posted by Finn
View Post
Do you understand anything about PAWN?
I was just thinking that.

The code shouldn't actually work, as you can assign strings to variable by just doing
pawn Code:
var = "string"



Re: Can this be changed (Rep+) - seanny - 11.12.2011

Quote:
Originally Posted by suhrab_mujeeb
View Post
pawn Code:
CMD:admins(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Online Admins:");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(PlayerInfo[i][pAdminLevel] >= 2 && PlayerInfo[i][pAdminLevel] < 6)
                {
                    new admtext[64], sendername[MAX_PLAYER_NAME], string[128];
                    if(PlayerInfo[i][pAdminLevel] == 5) { admtext = "Server Owner"; }
                    else if(PlayerInfo[i][pAdminLevel] == 4) { admtext = "Level 4 Admin"; }
                    else if(PlayerInfo[i][pAdminLevel] == 3) { admtext = "Level 3 Admin"; }
                    else if(PlayerInfo[i][pAdminLevel] == 2) { admtext = "Level 2 Admin"; }
                    else { admtext = "Basic Administrator"; }
                    GetPlayerName(i, sendername, sizeof(sendername));
                    sendername[strfind(sendername,"_")] = ' ';
                    if(AdminDuty[i] == 0)
                    {
                        format(string, 128, "%s: %s (Admin Duty: No)", admtext, sendername);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                    }
                    else
                    {
                        format(string, 128, "%s: %s (Admin Duty: Yes)", admtext, sendername);
                        SendClientMessage(playerid, COLOR_GREEN, string);

                    }
                }
            }
        }
    }
    return 1;
}
Untested.
That one wont work as it would show level 1 admins as Basic Administrator


Re: Can this be changed (Rep+) - suhrab_mujeeb - 11.12.2011

Quote:
Originally Posted by Finn
View Post
Do you understand anything about PAWN?
Who was that to? If it is to anyone, why don't you point out the mistakes so in future it doesn't happen again, don't just get your post count higher.

pawn Code:
CMD:admins(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Online Admins:");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(PlayerInfo[i][pAdminLevel] >= 2 && PlayerInfo[i][pAdminLevel] < 6)
                {
                    new admtext[64], sendername[MAX_PLAYER_NAME], string[128];
                    if(PlayerInfo[i][pAdminLevel] == 5) { admtext = "Server Owner"; }
                    else if(PlayerInfo[i][pAdminLevel] == 4) { admtext = "Level 4 Admin"; }
                    else if(PlayerInfo[i][pAdminLevel] == 3) { admtext = "Level 3 Admin"; }
                    else if(PlayerInfo[i][pAdminLevel] == 2) { admtext = "Level 2 Admin"; }
                    else return 0;
                    GetPlayerName(i, sendername, sizeof(sendername));
                    sendername[strfind(sendername,"_")] = ' ';
                    if(AdminDuty[i] == 0)
                    {
                        format(string, 128, "%s: %s (Admin Duty: No)", admtext, sendername);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                    }
                    else
                    {
                        format(string, 128, "%s: %s (Admin Duty: Yes)", admtext, sendername);
                        SendClientMessage(playerid, COLOR_GREEN, string);

                    }
                }
            }
        }
    }
    return 1;
}
EDIT: Try this.


Re: Can this be changed (Rep+) - FireCat - 11.12.2011

Quote:
Originally Posted by funky1234
View Post
I was just thinking that.

The code shouldn't actually work, as you can assign strings to variable by just doing
pawn Code:
var = "string"
But that var has a size array in it.
"admtext[64]"


Re: Can this be changed (Rep+) - Ash. - 11.12.2011

Quote:
Originally Posted by FireCat
View Post
But that var has a size array in it.
"admtext[64]"
But, whenever I've tried that it doesn't work...
+ If it wasn't specified as an array, it couldn't hold a string.


Re: Can this be changed (Rep+) - seanny - 11.12.2011

Quote:
Originally Posted by suhrab_mujeeb
View Post
Who was that to? If it is to anyone, why don't you point out the mistakes so in future it doesn't happen again, don't just get your post count higher.

pawn Code:
CMD:admins(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Online Admins:");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(PlayerInfo[i][pAdminLevel] >= 2 && PlayerInfo[i][pAdminLevel] < 6)
                {
                    new admtext[64], sendername[MAX_PLAYER_NAME], string[128];
                    if(PlayerInfo[i][pAdminLevel] == 5) { admtext = "Server Owner"; }
                    else if(PlayerInfo[i][pAdminLevel] == 4) { admtext = "Level 4 Admin"; }
                    else if(PlayerInfo[i][pAdminLevel] == 3) { admtext = "Level 3 Admin"; }
                    else if(PlayerInfo[i][pAdminLevel] == 2) { admtext = "Level 2 Admin"; }
                    else return 0;
                    GetPlayerName(i, sendername, sizeof(sendername));
                    sendername[strfind(sendername,"_")] = ' ';
                    if(AdminDuty[i] == 0)
                    {
                        format(string, 128, "%s: %s (Admin Duty: No)", admtext, sendername);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                    }
                    else
                    {
                        format(string, 128, "%s: %s (Admin Duty: Yes)", admtext, sendername);
                        SendClientMessage(playerid, COLOR_GREEN, string);

                    }
                }
            }
        }
    }
    return 1;
}
EDIT: Try this.
Thanks! Rep+'ed!