Skin won't change on spawn
#1

Well, the skin variable is loaded correctly, and saved correctly as well. But for some weird reason it won't change from CJ one to the one in the variable.

OnPlayerSpawn
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(gPlayerLogged[playerid] == 1)
    {
//==================================[FUEL TEXDRAW]==================================
        FuelText[playerid] = TextDrawCreate(509, 99,"Fuel: 100");
        TextDrawLetterSize(Text:FuelText[playerid], 0.370000, 1.500000);
        TextDrawColor(Text:FuelText[playerid], -1361844506);
        TextDrawSetOutline(Text:FuelText[playerid], 1);
        TextDrawSetProportional(Text:FuelText[playerid], 1);
//==================================[RESETTING PLAYER VARIABLES]==================================
        SetPlayerWeapons(playerid);
       
        SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
        SendClientMessage(playerid, COLOR_WHITE, "Skin changed"); // This doesn't show up as well!
        SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
        print("Skin SET");
        //gPlayerLogged[playerid] = 0;
        print("Variable set to FALSE");
        SetPlayerSpawn(playerid);
    }
    return 1;
}
The part of the login script that calls the OnPlayerSpawn
pawn Код:
SetSpawnInfo(playerid, 0, 0,2334.9993,240.1232,26.4758,180,0,0,0,0,0,0);
            SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
            SpawnPlayer(playerid);
            new string[100];
            format(string, sizeof(string), "Skin is: %d", PlayerInfo[playerid][pSkin]);
            print(string);
            gPlayerLogged[playerid] = 1;
            print("Variable set to TRUE.");
            OnPlayerSpawn(playerid);
Anyways, the skin doesn't change, it stays on ID 0 (cj skin) all the time.

Skin is loaded correctly, part from the log:
Код:
[20:19:32] Number of vehicle models: 7
[20:19:51] Incoming connection: 127.0.0.1:53644
[20:19:51] [join] xxxx_yyyy has joined the server (0:127.0.0.1)
[20:19:53] Skin is: 264
[20:19:53] Variable set to TRUE.
[20:19:53] Skin SET
[20:19:53] Variable set to FALSE
Reply
#2

Don't call OnPlayerSpawn call SpawnPlayer.
Reply
#3

SpawnPlayer is called, it's in the 3rd line of the 2nd code snippet. I'm calling OnPlayerSpawn to set the player position and weapons.

EDIT:

I replaced the variable with the number, still not working :S

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(gPlayerLogged[playerid] == 1)
    {
//==================================[FUEL TEXDRAW]==================================
        FuelText[playerid] = TextDrawCreate(509, 99,"Fuel: 100");
        TextDrawLetterSize(Text:FuelText[playerid], 0.370000, 1.500000);
        TextDrawColor(Text:FuelText[playerid], -1361844506);
        TextDrawSetOutline(Text:FuelText[playerid], 1);
        TextDrawSetProportional(Text:FuelText[playerid], 1);
//==================================[RESETTING PLAYER VARIABLES]==================================
        SetPlayerWeapons(playerid);
       
        SetPlayerSkin(playerid, 299);
        SendClientMessage(playerid, COLOR_WHITE, "Skin changed"); // This actually shows up, just haven't noticed.
        SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
        print("Skin SET");
        //gPlayerLogged[playerid] = 0;
        print("Variable set to FALSE");
        SetPlayerSpawn(playerid);
    }
    return 1;
}
Reply
#4

Try putting SetPlayerSkin AFTER SetPlayerSpawn.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)