How do I change color of a class?
#1

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?
Reply
#2

#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)
Reply
#3

Quote:
Originally Posted by mrskull42
Посмотреть сообщение
#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)
No no no no, I just want to replace my purple color for army instead of my green, Is that possible? I dont want to make a whole new SetPlayerColor, But I tried finding SetPlayerColor(playerid,COLOR_GREEN;Army
But I couldnt find it o.o
Reply
#4

Find the piece of coding that defines the army green colour and you'll see a colour code similar to somthing like this "0x33AA33AA" then just replace it with "0x800080AA"
Reply
#5

Didnt work, I changed teh green to purple but still doesnt work x.x
Reply
#6

Post your onplayerspawn and defines here so we can look further into the problems, and did you complie the file?
Reply
#7

Do you somewhere have got this line?

pawn Код:
SetPlayerToTeamColor(playerid)
Reply
#8

Quote:
Originally Posted by mrskull42
Посмотреть сообщение
Post your onplayerspawn and defines here so we can look further into the problems, and did you complie the file?
pawn Код:
//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;
}
Quote:
Originally Posted by Twisted_Insane
Посмотреть сообщение
Do you somewhere have got this line?

pawn Код:
SetPlayerToTeamColor(playerid)
Nope

Edit : Chrillzen what do you mean by code? Sorry but I wont give you my whole gamemode
Reply
#9

OMG, you just said you don't have it, but what the hell is this then?

pawn Код:
SetPlayerToTeamColour
Anyways, comparing with "else if" isn't a good idea, switch the cases here:

pawn Код:
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);
        }
    }
}
Reply
#10

Quote:
Originally Posted by Twisted_Insane
Посмотреть сообщение
OMG, you just said you don't have it, but what the hell is this then?

pawn Код:
SetPlayerToTeamColour
Anyways, comparing with "else if" isn't a good idea, switch the cases here:

pawn Код:
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);
        }
    }
}
You forgot to add the default case (team >= 9):
pawn Код:
default: SetPlayerColor(playerid,COLOR_WHITE);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)