04.03.2012, 16:07
Hey guys, I was just wondering how do I change color of a class? I mean for example, Army. They are usually green but what if I want to make it purple? What do I have to change?
#DEFINE COLOR_PURPLE 0x800080AA //At the top of the script where you define all your stuff
Then on public OnPlayerSpawn(playerid) { put "SetPlayerColor(playerid, COLOR_PURPLE);" on the team you want (without the quotes) |
SetPlayerToTeamColor(playerid)
Post your onplayerspawn and defines here so we can look further into the problems, and did you complie the file?
|
//Colours
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_VIOLETBLUE 0x8A2BE2AA
#define COLOR_DEADCONNECT 0x808080AA
#define COLOR_BLUE 0x0000FFAA
#define COLOR_FORESTGREEN 0x228B22AA
#define COLOR_DODGERBLUE 0x1E90FFAA
#define COLOR_DARKOLIVEGREEN 0x556B2FAA
#define COLOR_ORANGE 0xFFA500AA
#define COLOR_PURPLE 0x800080AA
#define COLOR_ROYALBLUE 0x4169FFAA
#define COLOR_ERROR 0xD2691EAA
#define COLOR_PINK 0xFF0080FF
#define COLOR_SEXYGREEN 0x00FF00FF
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIME 0x800080AA
#define COLOR_ADMIN 0x10F441AA // Currently Lime.
#define COLOR_CYAN 0x40FFFFFF
#define COLOR_ORANGERED 0xFF4500AA
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
if(strcmp(PlayerName(playerid), "Billy") == 0)
{
PutPlayerInVehicle(playerid,NPCTram,0);
SetPlayerColor(playerid,COLOR_DARKOLIVEGREEN);
SetPlayerSkin(playerid,255);
IsSpawned[playerid] =1;
print("[NPC SPAWN] Billy has been placed in his tram.");
}
return 1;
}
new string[128];
new pname[128];
GetPlayerName(playerid,pname,sizeof(pname));
//Namebanned
if(NameBanned[playerid] == 1)
{
format(string,sizeof(string),"[AUTO BAN] %s(%d) has been auto banned for ban evading. (Nickname is banned).",pname,playerid);
SendClientMessageToAll(COLOR_ADMIN,string);
format(string,sizeof(string),"9[AUTO BAN] %s(%d) has been auto banned for ban evading. (Nickname is banned).",pname,playerid);
IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
Banning[playerid] =1;
SetTimer("BanPlayer",700,0);
return 1;
}
SetPlayerWantedLevel(playerid,0);
SetPlayerToTeamColour(playerid);
//////xobject
PlayerObjectUpdate(playerid);
TextDrawShowForPlayer(playerid,LocationTD[playerid]);
GangZoneShowForPlayer(playerid, FBIZone, COLOR_BLUE);
GangZoneShowForPlayer(playerid, SFPDZone, COLOR_BLUE);
GangZoneShowForPlayer(playerid, ArmyZone, COLOR_FORESTGREEN);
GangZoneShowForPlayer(playerid, ncisZone, COLOR_ORANGERED);
GangZoneShowForPlayer(playerid, TaxiZone, COLOR_DARKOLIVEGREEN);
SetPlayerTime(playerid,gametime,0);
//Spawn Message
format(string, sizeof(string), "7[SPAWN] %s(%d)",pname,playerid);
IRC_GroupSay(gGroupID, IRC_CHANNEL,string);
//Set their job/skill
if(gTeam[playerid] == TEAM_COP && GetPlayerSkin(playerid) != 286)
{
ShowPlayerDialog(playerid,DIALOG_SKILLINFO,DIALOG_STYLE_MSGBOX,"{0000FF}POLICE OFFICER INFORMATION:","{FFFFFF}Commands: Type /commands for a list of police commands.\n{FFFFFF}Job: Your job is to deal with crime in San Fierro.\n{FFFFFF}Player Colours: For a list of what the player colors mean, type /pc.\n{FFFFFF}Don't forget to read the /rules of San Fierro CRRPG!","Ok","Cancel");
GivePlayerWeapon(playerid,31,500);
GivePlayerWeapon(playerid,29,300);
GivePlayerWeapon(playerid,3,1);
SetCameraBehindPlayer(playerid);
HasLawEnforcementRadio[playerid] =1;
}
if(gTeam[playerid] == TEAM_COP && GetPlayerSkin(playerid) == 286)
{
ShowPlayerDialog(playerid,DIALOG_SKILLINFO,DIALOG_STYLE_MSGBOX,"{0000FF}FBI INFORMATION:","{FFFFFF}Commands: Type /commands for a list of police commands.\n{FFFFFF}Job: Your job is to deal with crime in San Fierro.\n{FFFFFF}Player Colours: For a list of what the player colors mean, type /pc.\n{FFFFFF}Don't forget to read the /rules of San Fierro CRRPG!","Ok","Cancel");
GivePlayerWeapon(playerid,31,500);
GivePlayerWeapon(playerid,29,300);
GivePlayerWeapon(playerid,24,20);
GivePlayerWeapon(playerid,3,1);
SetCameraBehindPlayer(playerid);
HasLawEnforcementRadio[playerid] =1;
}
else if(gTeam[playerid] == TEAM_ARMY)
{
/*SendClientMessage(playerid,COLOR_VIOLETBLUE,"ARMY OFFICIAL INFORMATION:");
SendClientMessage(playerid,COLOR_VIOLETBLUE,"Commands: Type /commands for a list of Army commands.");
SendClientMessage(playerid,COLOR_VIOLETBLUE,"Job: Your main job is to take down red (Most Wanted) criminals.");
SendClientMessage(playerid,COLOR_VIOLETBLUE,"Please do not use the Army vehicles for any other purpose than your job.");
SendClientMessage(playerid,COLOR_VIOLETBLUE,"Although you are a Regular Player, don't forget to abide by the server /rules.");*/
ShowPlayerDialog(playerid,DIALOG_SKILLINFO,DIALOG_STYLE_MSGBOX,"{8A2BE2}ARMY OFFICIAL INFORMATION:","{FFFFFF}Commands: Type /commands for a list of Army commands.\n{FFFFFF}Job: Your main job is to take down red (Most Wanted) criminals.\n{FFFFFF}Please do not use the Army vehicles for any other purpose than your job.\n{FFFFFF}Although you are a Regular Player, don't forget to abide by the server /rules.","Ok","Cancel");
GivePlayerWeapon(playerid,31,500);
GivePlayerWeapon(playerid,34,60);
GivePlayerWeapon(playerid,24,80);
SetPlayerPos(playerid,-1380.7788,508.4977,18.2344);
SetPlayerFacingAngle(playerid,88.3392);
SetCameraBehindPlayer(playerid);
HasLawEnforcementRadio[playerid] =1;
}
else if(gTeam[playerid] == TEAM_ncis)
{
/*SendClientMessage(playerid,COLOR_VIOLETBLUE,"ncis INFORMATION:");
SendClientMessage(playerid,COLOR_VIOLETBLUE,"Commands: Type /commands for a list of ncis commands.");
SendClientMessage(playerid,COLOR_VIOLETBLUE,"Job: Your main job is to arrest red (Most Wanted) criminals.");
SendClientMessage(playerid,COLOR_VIOLETBLUE,"Although you are a Regular Player, don't forget to abide by the server /rules.");*/
ShowPlayerDialog(playerid,DIALOG_SKILLINFO,DIALOG_STYLE_MSGBOX,"{FFFF00}ncis INFORMATION:","{FFFFFF}Commands: Type /commands for a list of ncis commands.\n{FFFFFF}Job: Your main job is to arrest red (Most Wanted) criminals.\n{FFFFFF}Although you are a Regular Player, don't forget to abide by the server /rules.","Ok","Cancel");
GivePlayerWeapon(playerid,31,500);
GivePlayerWeapon(playerid,29,300);
GivePlayerWeapon(playerid,24,80);
SetPlayerPos( playerid, -2175.8274,1590.3749,16.9813 );
SetPlayerFacingAngle( playerid,270.6926 );
SetCameraBehindPlayer(playerid);
HasLawEnforcementRadio[playerid] =1;
}
else if(gTeam[playerid] == TEAM_MEDIC)
{
/*SendClientMessage(playerid,COLOR_FORESTGREEN,"MEDIC INFORMATION:");
SendClientMessage(playerid,COLOR_FORESTGREEN,"Commands: Type /commands for a list of Medic commands.");
SendClientMessage(playerid,COLOR_FORESTGREEN,"Job: Your job is to heal and cure unhealthy people in San Fierro.");
SendClientMessage(playerid,COLOR_FORESTGREEN,"Respond to people when they use the command /medic to call for you.");
SendClientMessage(playerid,COLOR_FORESTGREEN,"Please remember to abide by the server /rules, or you may be banned.");*/
ShowPlayerDialog(playerid,DIALOG_SKILLINFO,DIALOG_STYLE_MSGBOX,"{228B22}MEDIC INFORMATION:","{FFFFFF}Commands: Type /commands for a list of Medic commands.\n{FFFFFF}Job: Your job is to heal and cure unhealthy people in San Fierro.\n{FFFFFF}Respond to people when they use the command /medic to call for you.\n{FFFFFF}Please remember to abide by the server /rules, or you may be banned.","Ok","Cancel");
GivePlayerWeapon(playerid,22,60);
GivePlayerWeapon(playerid,4,1);
SetPlayerPos(playerid,-2558.2654,661.3560,14.45314);
SetPlayerFacingAngle(playerid,182.7825);
SetCameraBehindPlayer(playerid);
}
else if(gTeam[playerid] == TEAM_CARFIX)
{
/*SendClientMessage(playerid,COLOR_WHITE,"MECHANIC INFORMATION:");
SendClientMessage(playerid,COLOR_WHITE,"Commands: Type /commands for a list of Mechanic commands.");
SendClientMessage(playerid,COLOR_WHITE,"Job: Your job is to fix players vehicles whenever they get damaged.");
SendClientMessage(playerid,COLOR_WHITE,"Respond to people when they use the command /mechanic to call you.");
SendClientMessage(playerid,COLOR_WHITE,"Please remember to abide by the server /rules, or you may be banned.");*/
ShowPlayerDialog(playerid,DIALOG_SKILLINFO,DIALOG_STYLE_MSGBOX,"{4169FF}MECHANIC INFORMATION:","{FFFFFF}Commands: Type /commands for a list of Mechanic commands.\n{FFFFFF}Job: Your job is to repair players vehicles in San Fierro.\n{FFFFFF}Respond to people when they use the command /mechanic to call for you.\n{FFFFFF}Please remember to abide by the server /rules, or you may be banned.","Ok","Cancel");
GivePlayerWeapon(playerid,22,60);
GivePlayerWeapon(playerid,4,1);
SetPlayerPos(playerid,-2032.1998,148.3631,28.8359);
SetPlayerFacingAngle(playerid,271.3353);
SetCameraBehindPlayer(playerid);
}
else if(gTeam[playerid] == TEAM_DRIVER)
{
/*SendClientMessage(playerid,COLOR_DARKOLIVEGREEN,"DRIVER INFORMATION:");
SendClientMessage(playerid,COLOR_DARKOLIVEGREEN,"Commands: Type /commands for a list of Driver commands.");
SendClientMessage(playerid,COLOR_DARKOLIVEGREEN,"Job: Your job is to collect players at take them to their destination.");
SendClientMessage(playerid,COLOR_DARKOLIVEGREEN,"Respond to people when they use the command /driver to call you.");
SendClientMessage(playerid,COLOR_DARKOLIVEGREEN,"Please remember to abide by the server /rules, or you may be banned.");*/
ShowPlayerDialog(playerid,DIALOG_SKILLINFO,DIALOG_STYLE_MSGBOX,"{556B2F}DRIVER INFORMATION:","{FFFFFF}Commands: Type /commands for a list of Driver commands.\n{FFFFFF}Job: Your job is to collect players at take them to their destination.\n{FFFFFF}Respond to people when they use the command /driver to call for you.\n{FFFFFF}Please remember to abide by the server /rules, or you may be banned.","Ok","Cancel");
GivePlayerWeapon(playerid,22,60);
GivePlayerWeapon(playerid,4,1);
GivePlayerWeapon(playerid,5,1);
SetPlayerPos(playerid,-1674.9299,1334.6108,7.1875);
SetPlayerFacingAngle(playerid,221.6657);
SetCameraBehindPlayer(playerid);
}
else if(gTeam[playerid] >= 9)
{
SendClientMessage(playerid,COLOR_WHITE,"CIVILIAN INFORMATION:");
SendClientMessage(playerid,COLOR_WHITE,"Please choose a skill from the menu below.");
CanChooseSkill[playerid] =1;
ShowMenuForPlayer(SkillMenu,playerid);
TogglePlayerControllable(playerid,0);
new rnd = random(sizeof(SpawnPoints));
SetPlayerPos(playerid,SpawnPoints[rnd][0],SpawnPoints[rnd][1],SpawnPoints[rnd][2]);
SetPlayerFacingAngle(playerid,SpawnPoints[rnd][3]);
SetCameraBehindPlayer(playerid);
}
//Saved Stats
if(SavedWantedLevel[playerid] != 0)
{
SetPlayerWantedLevel(playerid,SavedWantedLevel[playerid]);
SavedWantedLevel[playerid] =0;
SendClientMessage(playerid,COLOR_RED,"You have left the server while wanted. Wanted level restored.");
}
if(SavedJailTime[playerid] != 0)
{
TextDrawShowForPlayer(playerid,JailTimer[playerid]);
ResetPlayerWeapons(playerid);
new rnd = random(sizeof(JailSpawnPoints));
JailTime[playerid] =SavedJailTime[playerid];
IsCuffed[playerid] =0;
CuffTime[playerid] =0;
TotalJailTime[playerid] =SavedJailTime[playerid];
SetPlayerInterior(playerid,10);
SetPlayerPos(playerid,JailSpawnPoints[rnd][0],JailSpawnPoints[rnd][1],JailSpawnPoints[rnd][2]);
SetPlayerFacingAngle(playerid,JailSpawnPoints[rnd][3]);
TogglePlayerControllable(playerid,1);
StopLoopingAnim(playerid);
SetPlayerWantedLevel(playerid,0);
SetPlayerToTeamColour(playerid);
SavedJailTime[playerid] =0;
SendClientMessage(playerid,COLOR_RED,"You have left the server while in jail. You must finish your sentence.");
format(string,sizeof(string),"[AUTO JAIL] %s(%d) has been auto jailed for leaving the server while in jail. He will finish his sentence.",PlayerName(playerid),playerid);
SendClientMessageToAll(COLOR_ADMIN,string);
format(string,sizeof(string),"9[AUTO JAIL] %s(%d) has been auto jailed for leaving the server while in jail. He will finish his sentence.",PlayerName(playerid),playerid);
IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
}
//Set Variables
IsSpawned[playerid] =1;
return 1;
}
public SetPlayerToTeamColour(playerid)
{
if(gTeam[playerid] == TEAM_COP)
{
SetPlayerColor(playerid,COLOR_BLUE);
}
if(gTeam[playerid] == TEAM_ARMY)
{
SetPlayerColor(playerid,COLOR_FORESTGREEN);
}
if(gTeam[playerid] == TEAM_ncis)
{
SetPlayerColor(playerid,COLOR_ORANGERED);
}
if(gTeam[playerid] == TEAM_MEDIC)
{
SetPlayerColor(playerid,COLOR_FORESTGREEN);
}
if(gTeam[playerid] == TEAM_CARFIX)
{
SetPlayerColor(playerid,COLOR_WHITE);
}
if(gTeam[playerid] == TEAM_DRIVER)
{
SetPlayerColor(playerid,COLOR_DARKOLIVEGREEN);
}
if(gTeam[playerid] >= 9)
{
SetPlayerColor(playerid,COLOR_WHITE);
}
return 1;
}
Do you somewhere have got this line?
pawn Код:
|
SetPlayerToTeamColour
SetPlayerToTeamColour(playerid)
{
switch(gTeam[playerid])
{
case TEAM_COP:
{
SetPlayerColor(playerid, COLOR);
}
case TEAM_ARMY:
{
SetPlayerColor(playerid, COLOR);
}
case TEAM_ncis:
{
SetPlayerColor(playerid, COLOR);
}
case TEAM_MEDIC:
{
SetPlayerColor(playerid, COLOR);
}
case TEAM_CARFIX:
{
SetPlayerColor(playerid, COLOR);
}
case TEAM_DRIVER:
{
SetPlayerColor(playerid, COLOR);
}
}
}
OMG, you just said you don't have it, but what the hell is this then?
pawn Код:
pawn Код:
|
default: SetPlayerColor(playerid,COLOR_WHITE);