SA-MP Forums Archive
SetPlayerColor not working - 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: SetPlayerColor not working (/showthread.php?tid=359176)



SetPlayerColor not working[+rep] - ZBits - 13.07.2012

hello i have a problem with setplayercolor

whenever i go on duty ,according to my script my color should turn to blue but it stays white


here's the code

pawn Код:
switch(dialogid)
{
case 1:
{
if(!response)
{
SendClientMessage(playerid, COLOR_PINK2, "You Canceled");
return 1;
}
switch(listitem)
{
case 0:
{
if(gTeam[playerid] == TEAM_CIV)
{
SetPlayerColor(playerid,COLOR_LIGHTBLUE);
OffDutySkin[playerid] = GetPlayerSkin(playerid);
SetPlayerSkin(playerid,280);
SendClientMessage(playerid,COLOR_LAWNGREEN,"Welcome to Duty USPD Officer");
gTeam[playerid] = TEAM_COP;
}
else if(GetPlayerTeam(playerid) !=TEAM_CIV)
SendClientMessage(playerid,COLOR_PINK2,"You Cant go on Cop Duty");
}
case 1:
{
if(gTeam[playerid] == TEAM_CIV)
{
SetPlayerColor(playerid,COLOR_LIGHTBLUE);
OffDutySkin[playerid] = GetPlayerSkin(playerid);
SetPlayerSkin(playerid,281);
SendClientMessage(playerid,COLOR_LAWNGREEN,"Welcome to Duty USPD Officer");
gTeam[playerid] = TEAM_COP;
}
else if(GetPlayerTeam(playerid) !=TEAM_CIV)
SendClientMessage(playerid,COLOR_PINK2,"You Cant go on Cop Duty");
}
case 2:
{
if(gTeam[playerid] == TEAM_CIV)
{
SetPlayerColor(playerid,COLOR_LIGHTBLUE);
OffDutySkin[playerid] = GetPlayerSkin(playerid);
SetPlayerSkin(playerid,282);
SendClientMessage(playerid,COLOR_LAWNGREEN,"Welcome to Duty USPD Officer");
gTeam[playerid] = TEAM_COP;
}
else if(GetPlayerTeam(playerid) !=TEAM_CIV)
SendClientMessage(playerid,COLOR_PINK2,"You Cant go on Cop Duty");
}
case 3:
{
SendClientMessage(playerid,COLOR_PINK2,"Stay a Law full Citizen");
gTeam[playerid] = TEAM_CIV;
SetPlayerSkin(playerid, OffDutySkin[playerid]);
SetPlayerColor(playerid,COLOR_WHITE);
}
}
}



Re: SetPlayerColor not working - Vince - 13.07.2012

Please indent. I'm sure there is some logic error in your code.


Re: SetPlayerColor not working - Captain_Mani - 13.07.2012

Make sure that you have defined COLOR_LIGHTBLUE on very top of your script. And also make sure that you have defined the light blue color.


Re: SetPlayerColor not working - clarencecuzz - 13.07.2012

Post your #define COLOR_LIGHTBLUE line, so then we will be able to make sure you have the proper hex value for this code.


Re: SetPlayerColor not working - ZBits - 13.07.2012

#define COLOR_LIGHTBLUE 0x33CCFFAA

and @vince i get no errors


Re: SetPlayerColor not working - Mr.Fames - 13.07.2012

Quote:
Originally Posted by Domnic Toretto
Посмотреть сообщение
#define COLOR_LIGHTBLUE 0x33CCFFAA

and @vince i get no errors
You get no errors but you get warnings


Re: SetPlayerColor not working - Vince - 13.07.2012

I am talking about logic errors, not syntax errors. Consider the following example:
pawn Код:
if(GetPlayerScore(playerid) < 100 && GetPlayerScore(playerid) > 100)
This is still syntactically correct and it will compile, but it obviously won't work.


Re: SetPlayerColor not working - clarencecuzz - 13.07.2012

Try
pawn Код:
SetPlayerColor(playerid, 0x33CCFFAA);
This probably won't change anything, but there is a possibility that your client just isn't receiving the data.
Sometimes in scripts, when you set a players color, lets say you set you enter the server as a blue player. Then you set your color to red, but when you speak you're still blue? Other players might see you as red, however the change may not apply to you. Get another player on the server to tell you what color you are, as it may not be reading properly for you.


Re: SetPlayerColor not working - ZBits - 13.07.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
I am talking about logic errors, not syntax errors. Consider the following example:
pawn Код:
if(GetPlayerScore(playerid) < 100 && GetPlayerScore(playerid) > 100)
This is still syntactically correct and it will compile, but it obviously won't work.
i gave the code above it will be very help full if you check those login errors


Re: SetPlayerColor not working - ZBits - 13.07.2012

anyone?