SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/12/2011, 10:37 AM   #1
seanny
High-roller
 
seanny's Avatar
 
Join Date: Oct 2010
Posts: 1,429
Reputation: 41
Question Can this be changed (Rep+)

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;
}
__________________
I'm no longer part of the SA-MP scene. I will not respond to any support requests.
Developer @ Outlaw Games Studio
https://discord.gg/BR2FCTm
seanny is offline   Reply With Quote
Old 11/12/2011, 10:39 AM   #2
suhrab_mujeeb
Guest
 
Posts: n/a
Default Re: Can this be changed (Rep+)

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.
  Reply With Quote
Old 11/12/2011, 10:47 AM   #3
Finn
High-roller
 
Join Date: Jan 2008
Posts: 1,464
Reputation: 382
Default Re: Can this be changed (Rep+)

Do you understand anything about PAWN?
Finn is offline   Reply With Quote
Old 11/12/2011, 10:48 AM   #4
Ash.
High-roller
 
Ash.'s Avatar
 
Join Date: Jan 2010
Location: England
Posts: 2,082
Reputation: 163
Default Re: Can this be changed (Rep+)

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"
__________________
TruckingWorld
Work, Play, Make Friends
Written from scratch, and originally released in 2011, play today!
Visit the forum | Play the game
Ash. is offline   Reply With Quote
Old 11/12/2011, 10:51 AM   #5
seanny
High-roller
 
seanny's Avatar
 
Join Date: Oct 2010
Posts: 1,429
Reputation: 41
Default Re: Can this be changed (Rep+)

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
__________________
I'm no longer part of the SA-MP scene. I will not respond to any support requests.
Developer @ Outlaw Games Studio
https://discord.gg/BR2FCTm
seanny is offline   Reply With Quote
Old 11/12/2011, 10:52 AM   #6
suhrab_mujeeb
Guest
 
Posts: n/a
Default Re: Can this be changed (Rep+)

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.
  Reply With Quote
Old 11/12/2011, 10:54 AM   #7
FireCat
High-roller
 
FireCat's Avatar
 
Join Date: Jul 2010
Posts: 2,322
Reputation: 609
Default Re: Can this be changed (Rep+)

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]"
FireCat is offline   Reply With Quote
Old 11/12/2011, 11:02 AM   #8
Ash.
High-roller
 
Ash.'s Avatar
 
Join Date: Jan 2010
Location: England
Posts: 2,082
Reputation: 163
Default Re: Can this be changed (Rep+)

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.
__________________
TruckingWorld
Work, Play, Make Friends
Written from scratch, and originally released in 2011, play today!
Visit the forum | Play the game
Ash. is offline   Reply With Quote
Old 11/12/2011, 12:20 PM   #9
seanny
High-roller
 
seanny's Avatar
 
Join Date: Oct 2010
Posts: 1,429
Reputation: 41
Default Re: Can this be changed (Rep+)

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!
__________________
I'm no longer part of the SA-MP scene. I will not respond to any support requests.
Developer @ Outlaw Games Studio
https://discord.gg/BR2FCTm
seanny is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can this be changed please, Thanks! (Rep+) seanny Scripting Help 4 29/11/2011 03:39 PM
Can this be changed please, Thanks! seanny Scripting Help 2 26/11/2011 12:32 PM
Can this be changed please, Thanks! seanny Scripting Help 1 18/10/2011 08:24 PM
I changed the Sentence whatever i want but IG no thing Changed Jaber_Brown Help Archive 13 26/05/2010 02:30 PM
Changed to SA:MP Hot Help Archive 1 21/02/2010 09:18 PM


All times are GMT. The time now is 03:47 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.