Previous colour? - 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)
+--- Thread: Previous colour? - help! (
/showthread.php?tid=470308)
Previous colour? - help! -
Chrillzen - 17.10.2013
Hey. So when an admin goes on duty his nametag turns to orange. Now, I'm going to have different colours players nametags on my server so I need this command to work.
Whenever they get back from adminduty their colour turns to whatever colour they had before going on adminduty. Please help!
My code sofar:
pawn Код:
CMD:adminduty(playerid,params[])
{
new string[128];
if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid,COLOR_GREY,"[Error]: You're not authorized to use this command.");
if(aDuty[playerid] == 0)
{
aDuty[playerid] = 1;
format(string, sizeof(string), "AmdCmd: %s has went on adminduty.", GetName(playerid));
ABroadCast(COLOR_LIGHTRED,string,1);
SetPlayerColor(playerid, COLOR_ADMIN);
}
else if(aDuty[playerid] == 1)
{
aDuty[playerid] = 0;
format(string, sizeof(string), "AmdCmd: %s has went on adminduty.", GetName(playerid));
ABroadCast(COLOR_LIGHTRED,string,1);
SetPlayerColor(playerid, PREVIOUS_COLOR?);
}
return 1;
}
Re: Previous colour? - help! -
venomlivno8 - 17.10.2013
pawn Код:
new previouscolor[MAX_PLAYERS];
CMD:adminduty(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid,COLOR_GREY,"[Error]: You're not authorized to use this command.");
if(aDuty[playerid] == 0)
{
aDuty[playerid] = 1;
new oldcol = GetPlayerColor(playerid);
previouscolor[playerid] = oldcol;
SCM(playerid, COLOR_ADMIN, "[Admin]: You're now ON adminduty.");
SetPlayerColor(playerid, COLOR_ADMIN);
}
else if(aDuty[playerid] == 1)
{
aDuty[playerid] = 0;
SCM(playerid, COLOR_ADMIN, "[Admin]: You're now OFF adminduty.");
SetPlayerColor(playerid, previouscolor[playerid]);
}
return 1;
}
Re: Previous colour? - help! -
Konstantinos - 17.10.2013
pawn Код:
// global variable
new
Previous_Colour[ MAX_PLAYERS ]
;
pawn Код:
CMD:adminduty(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid,COLOR_GREY,"[Error]: You're not authorized to use this command.");
if(aDuty[playerid] == 0)
{
aDuty[playerid] = 1;
SCM(playerid, COLOR_ADMIN, "[Admin]: You're now ON adminduty.");
Previous_Colour[playerid] = GetPlayerColor(playerid);
SetPlayerColor(playerid, COLOR_ADMIN);
}
else if(aDuty[playerid] == 1)
{
aDuty[playerid] = 0;
SCM(playerid, COLOR_ADMIN, "[Admin]: You're now OFF adminduty.");
SetPlayerColor(playerid, Previous_Colour[playerid]);
}
return 1;
}
Re: Previous colour? - help! -
tyler12 - 17.10.2013
pawn Код:
new pPreviousColor[MAX_PLAYERS];
CMD:adminduty(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid,COLOR_GREY,"[Error]: You're not authorized to use this command.");
if(aDuty[playerid] == 0)
{
aDuty[playerid] = 1;
SCM(playerid, COLOR_ADMIN, "[Admin]: You're now ON adminduty.");
pPreviousColor[playerid] = GetPlayerColor(playerid);
SetPlayerColor(playerid, COLOR_ADMIN);
}
else if(aDuty[playerid] == 1)
{
aDuty[playerid] = 0;
SCM(playerid, COLOR_ADMIN, "[Admin]: You're now OFF adminduty.");
SetPlayerColor(playerid, pPreviousColor[playerid]);
}
return 1;
}
EDIT: Very late
Re: Previous colour? - help! -
Chrillzen - 17.10.2013
Thanks, guys!