SetPlayerColor is not working.
#1

I'm becoming a bit annoyed. :/
A simple command, SetPlayerColor, it is not working for me.
Here's my code:

pawn Код:
public OnPlayerSpawn(playerid)
{

    GetPlayerName(playerid, aname, sizeof(aname));
    format(file, sizeof(file), "Users/%s.ini", aname);
   
    if(fexist(file))
    {
        if(PlayerInfo[playerid][Rented] == 1)
        {
            format(file, sizeof(file), "Houses/House_%d.ini", PlayerInfo[playerid][RentedHouseID]);
            SetPlayerPos(playerid, HouseInfo[PlayerInfo[playerid][RentedHouseID]][ExitX], HouseInfo[PlayerInfo[playerid][RentedHouseID]][ExitY], HouseInfo[PlayerInfo[playerid][RentedHouseID]][ExitZ]);
            SetPlayerVirtualWorld(playerid, HouseInfo[PlayerInfo[playerid][RentedHouseID]][VWorld]);
            SetPlayerInterior(playerid, dini_Int(file, "InteriorID"));
            InHouse[playerid] = true;
        }
    }
    else
    {
        PlayerInfo[playerid][Rented] = 0;
        PlayerInfo[playerid][RentedHouseID] = -1;
        SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerInterior(playerid, 0);
    }
   
   
    // Sets a player's skin to his last used skin on spawn.
    if(fexist(file)) return SetPlayerSkin(playerid, dini_Int(file, "SkinID"));
   
    // Faction player colors.
    if(PlayerInfo[playerid][Faction] > 0)
    {
        if(PlayerInfo[playerid][Tier] == 0)
        {
            SetPlayerColor(playerid, COLOR_PLAYER_TIER_ZERO);
        }
        if(PlayerInfo[playerid][Faction] == 1 && PlayerInfo[playerid][Tier] != 0)
        {
            SetPlayerColor(playerid, COLOR_PLAYER_SINDACCO);
        }
    }
    else
    {
        SetPlayerColor(playerid, 0xFFFFFFFF);
    }
    SetPlayerColor(playerid, 0xFFFFFFFF);
   
    // The end.
    return 1;
}
I've set my account's faction value to 0, therefore everything may be ignored, the rent may be ignored aswell, as it has nothing to do with it, I just wanted to provide the full code.

What am I doing wrong? :/
Reply
#2

Remove the SetPlayerColor above the return 1;

Also remove the return in
pawn Код:
if(fexist(file)) return SetPlayerSkin(playerid, dini_Int(file, "SkinID"));
Reply
#3

Duh, you're setting the player's color to white at the very end, thereby ignoring anything that has been previously set.
Reply
#4

No.. It does not set to white, I've set it to white there to check if it's working, I always get random colors such as purple and orange.

EDIT: I'm not that dumb. xD
Ye, it works now, thank you Antonio.
Reply
#5

Read what I edited in my post - that return is probably why it's not working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)