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



SetPlayerColor is not working. - Denying - 16.03.2013

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? :/


Re: SetPlayerColor is not working. - [ABK]Antonio - 16.03.2013

Remove the SetPlayerColor above the return 1;

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



Re: SetPlayerColor is not working. - Vince - 16.03.2013

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


Re: SetPlayerColor is not working. - Denying - 16.03.2013

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.


Re: SetPlayerColor is not working. - [ABK]Antonio - 16.03.2013

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