SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 28/06/2012, 09:06 PM   #1
trulis
Big Clucker
 
Join Date: Mar 2011
Location: Romania
Posts: 96
Reputation: 1
Default [HELP] regain player color

pawn Code:
if(strcmp(cmd, "/aod", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(aduty[playerid] == 0)
                {
                    aduty[playerid] = 1;
                    SetPlayerHealth(playerid, 99999);
                    SetPlayerArmour(playerid, 99999);
                    SetPlayerColor(playerid, COLOR_LIGHTRED);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "[FioriGinal]: %s went on admin duty!", sendername);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                }
                else
                {
                    aduty[playerid] = 0;
                    SetPlayerHealth(playerid, 100);
                    SetPlayerArmour(playerid, 0);
                    SetPlayerColor(playerid, COLOR_LIGHTRED);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "[FioriGinal]: %s went off admin duty!", sendername);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                }
            }
            else
            {
            SendClientMessage(playerid, COLOR_WHITE, "  Nu esti admin !");
            }
        }
        return 1;
    }
I made this command and i want to know how can i make it that when the admin goes off duty he regains his original color.
__________________
trulis is offline   Reply With Quote
Old 28/06/2012, 09:30 PM   #2
Strech
Huge Clucker
 
Strech's Avatar
 
Join Date: Jan 2012
Location: GetPlayerPos
Posts: 223
Reputation: 11
Default Re: [HELP] regain player color

pawn Code:
if(strcmp(cmd, "/aod", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(aduty[playerid] == 0)
                {
                    aduty[playerid] = 1;
                    SetPlayerHealth(playerid, 99999);
                    SetPlayerArmour(playerid, 99999);
                    SetPlayerColor(playerid, COLOR_LIGHTRED);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "[FioriGinal]: %s went on admin duty!", sendername);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                }
                else
                {
                    aduty[playerid] = 0;
                    SetPlayerHealth(playerid, 100);
                    SetPlayerArmour(playerid, 0);
                    SetPlayerColor(playerid, COLOR_WHITE);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "[FioriGinal]: %s went off admin duty!", sendername);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                }
            }
            else
            {
            SendClientMessage(playerid, COLOR_WHITE, "  Nu esti admin !");
            }
        }
        return 1;
    }
Try it this way sir
__________________

I hope you pay us a visit.
Strech is offline   Reply With Quote
Old 28/06/2012, 09:51 PM   #3
trulis
Big Clucker
 
Join Date: Mar 2011
Location: Romania
Posts: 96
Reputation: 1
Default Re: [HELP] regain player color

The problem is that my server is running an rpg gm so the players are in factions and every factions has a specific color
__________________
trulis is offline   Reply With Quote
Old 28/06/2012, 09:52 PM   #4
Strech
Huge Clucker
 
Strech's Avatar
 
Join Date: Jan 2012
Location: GetPlayerPos
Posts: 223
Reputation: 11
Default Re: [HELP] regain player color

You wanted when admin leaves duty,to get white color like normal players right?
__________________

I hope you pay us a visit.
Strech is offline   Reply With Quote
Old 28/06/2012, 09:55 PM   #5
Berlovan
Gangsta
 
Berlovan's Avatar
 
Join Date: Dec 2009
Posts: 993
Reputation: 129
Default Re: [HELP] regain player color

Check what faction he is in and give him that color.
__________________

hi
Berlovan is offline   Reply With Quote
Old 28/06/2012, 10:00 PM   #6
Strech
Huge Clucker
 
Strech's Avatar
 
Join Date: Jan 2012
Location: GetPlayerPos
Posts: 223
Reputation: 11
Default Re: [HELP] regain player color

Quote:
Originally Posted by trulis View Post
pawn Code:
if(strcmp(cmd, "/aod", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(aduty[playerid] == 0)
                {
                    aduty[playerid] = 1;
                    SetPlayerHealth(playerid, 99999);
                    SetPlayerArmour(playerid, 99999);
                    SetPlayerColor(playerid, COLOR_LIGHTRED);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "[FioriGinal]: %s went on admin duty!", sendername);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                }
                else
                {
                    aduty[playerid] = 0;
                    SetPlayerHealth(playerid, 100);
                    SetPlayerArmour(playerid, 0);
                    SetPlayerColor(playerid, COLOR_LIGHTRED);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "[FioriGinal]: %s went off admin duty!", sendername);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                }
            }
            else
            {
            SendClientMessage(playerid, COLOR_WHITE, "  Nu esti admin !");
            }
        }
        return 1;
    }
I made this command and i want to know how can i make it that when the admin goes off duty he regains his original color.
He needed the admin to get white color after leaving the duty.
__________________

I hope you pay us a visit.
Strech is offline   Reply With Quote
Old 28/06/2012, 10:04 PM   #7
Berlovan
Gangsta
 
Berlovan's Avatar
 
Join Date: Dec 2009
Posts: 993
Reputation: 129
Default Re: [HELP] regain player color

You clearly lack the ability to understand people.

"The problem is that my server is running an rpg gm so the players are in factions and every factions has a specific color "

This means that if the admin is in a certain faction, you can't just set their name white. That would mean they're faction-less or whatever. I assume there is a pColor[playerid] somewhere in the script that has the admin's or any player's faction color stored.
__________________

hi
Berlovan is offline   Reply With Quote
Old 29/06/2012, 08:17 AM   #8
trulis
Big Clucker
 
Join Date: Mar 2011
Location: Romania
Posts: 96
Reputation: 1
Default Re: [HELP] regain player color

pawn Code:
if(strcmp(cmd, "/aod", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new curcolor;
            curcolor = GetPlayerColor(playerid);
            if(PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(aduty[playerid] == 0)
                {
                    aduty[playerid] = 1;
                    SetPlayerHealth(playerid, 99999);
                    SetPlayerArmour(playerid, 99999);
                    SetPlayerColor(playerid, COLOR_LIGHTRED);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "[FioriGinal]: %s went on admin duty!", sendername);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                }
                else
                {
                    aduty[playerid] = 0;
                    SetPlayerHealth(playerid, 100);
                    SetPlayerArmour(playerid, 0);
                    SetPlayerColor(playerid, curcolor);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "[FioriGinal]: %s went off admin duty!", sendername);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                }
            }
            else
            {
            SendClientMessage(playerid, COLOR_WHITE, "  Nu esti admin !");
            }
        }
        return 1;
    }
i thought of using GetPlayerColor so i made this, is this going to work ?
__________________
trulis is offline   Reply With Quote
Old 29/06/2012, 08:20 AM   #9
iggy1
High-roller
 
iggy1's Avatar
 
Join Date: Mar 2009
Location: One past the end.
Posts: 2,383
Reputation: 235
Default Re: [HELP] regain player color

Test it.
__________________
Quote:
Originally Posted by Y_Less
That code compiles perfectly, but I can tell you now it won't make me a cup of tea.
"No offense, but you are a stupid asshole." - Ron Burgundy
iggy1 is offline   Reply With Quote
Old 29/06/2012, 09:23 AM   #10
.Wicked
Big Clucker
 
Join Date: Jun 2012
Posts: 74
Reputation: 2
Default Re: [HELP] regain player color

Not sure if it's going to work but I hope so

pawn Code:
new PlayerOldColor[MAX_PLAYERS];

pawn Code:
if(strcmp(cmd, "/aod", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new curcolor;
            if(PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(aduty[playerid] == 0)
                {
                    aduty[playerid] = 1;
                    SetPlayerHealth(playerid, 99999);
                    SetPlayerArmour(playerid, 99999);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "[FioriGinal]: %s went on admin duty!", sendername);
                    PlayerOldColor[playerid] = GetPlayerColor(playerid);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                }
                else
                {
                    aduty[playerid] = 0;
                    SetPlayerHealth(playerid, 100);
                    SetPlayerArmour(playerid, 0);
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "[FioriGinal]: %s went off admin duty!", sendername);
                    SetPlayerColor(playerid, PlayerOldColor[playerid]);
                    SendClientMessageToAll(COLOR_LIGHTRED, string);
                }
            }
            else
            {
            SendClientMessage(playerid, COLOR_WHITE, "  Nu esti admin !");
            }
        }
        return 1;
    }
.Wicked 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
player color help +rep Anthony_X Scripting Help 14 11/01/2012 07:10 PM
Player Color Bug Unknown123 Help Archive 3 16/03/2011 11:22 PM
Need help about player color ! shabi rox Help Archive 3 23/06/2010 04:25 PM
player color Robbin237 Help Archive 0 22/04/2009 04:29 PM
set player color My_Waffles_Bitch_L0L Help Archive 8 12/02/2009 08:59 AM


All times are GMT. The time now is 02:50 AM.


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