SetPlayerSkin
#1

I have a function that I scripted that is supposed to read from the file Assets.ini through a stock that is initiated when the gamemode initates, which sets a variable to set

pawn Код:
SpawnSkin = dini_Int("Assets.ini", "SpawnSkin");
And so I begin to load this skin via a callback, called when the player successfully registers their password into the register dialog.

pawn Код:
public Register(playerid, password[])
{
    new string[128], Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(string, sizeof(string), "Accounts/%s.ini", Name);

    if(!fexist(string))
    {
        Player[playerid][Registered] = 0;
        dini_Create(string);
        format(Player[playerid][Password], 128, "%s", password);
        dini_Set(string, "Password", password);
        dini_FloatSet(string, "PlayerX", 0.0);
        dini_FloatSet(string, "PlayerY", 0.0);
        dini_FloatSet(string, "PlayerZ", 0.0);

        SetSpawnInfo(playerid, 0, SpawnSkin, SpawnX, SpawnZ, SpawnY, SpawnA, 0, 0, 0, 0, 0, 0);
        SpawnPlayer(playerid);
       
        SetPlayerPos(playerid, SpawnX, SpawnY, SpawnZ);
        SetPlayerFacingAngle(playerid, SpawnA);
        SetPlayerSkin(playerid, SpawnSkin);
        SetPlayerInterior(playerid, SpawnInt);
        SetPlayerVirtualWorld(playerid, SpawnWorld);
    }
    else
    {
        SendClientMessage(playerid, ORANGE, "You're account already exsists. Relog and complete your login.");
        Kick(playerid);
    }
    return 1;
}
Yet it will not set the players skin, even though the file clearly states SpawnSkin=59. I've tried several options, even putting it under OnPlayerSpawn, and still nothing. I get no errors, but I have this stock at the bottom of the script that, as I said earlier, sets the variable.

pawn Код:
stock InitFileVars()
{

    if(fexist("Assets.ini"))
    {
        SpawnX = dini_Float("Assets.ini", "SpawnX");
        SpawnY = dini_Float("Assets.ini", "SpawnY");
        SpawnZ = dini_Float("Assets.ini", "SpawnZ");
        SpawnInt = dini_Int("Assets.ini", "SpawnInt");
        SpawnWorld = dini_Int("Assets.ini", "SpawnWorld");
        SpawnSkin = dini_Int("Assets.ini", "SpawnSkin");
        print("[system] Successfully initiated file Assets.ini! Proceeding...");
    }
    else
    {
        print("[system] Assets.ini is missing! /setspawn anywhere to create the file.");
    }
    return 1;
}
No errors... Any ideas?

REP+
Reply
#2

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
So lets try debugging ?

pawn Код:
if(fexist("Assets.ini"))
    {
        SpawnX = dini_Float("Assets.ini", "SpawnX");
        SpawnY = dini_Float("Assets.ini", "SpawnY");
        SpawnZ = dini_Float("Assets.ini", "SpawnZ");
        SpawnInt = dini_Int("Assets.ini", "SpawnInt");
        SpawnWorld = dini_Int("Assets.ini", "SpawnWorld");
        SpawnSkin = dini_Int("Assets.ini", "SpawnSkin");
        printf("loaded as: %i", SpawnSkin);
        print("[system] Successfully initiated file Assets.ini! Proceeding...");
    }
    else
    {
        print("[system] Assets.ini is missing! /setspawn anywhere to create the file.");
    }

public Register(playerid, password[])
{
    new string[128], Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(string, sizeof(string), "Accounts/%s.ini", Name);

    if(!fexist(string))
    {
        Player[playerid][Registered] = 0;
        dini_Create(string);
        format(Player[playerid][Password], 128, "%s", password);
        dini_Set(string, "Password", password);
        dini_FloatSet(string, "PlayerX", 0.0);
        dini_FloatSet(string, "PlayerY", 0.0);
        dini_FloatSet(string, "PlayerZ", 0.0);
       
        printf("test1: %i", SpawnSkin);
       
        SetSpawnInfo(playerid, 0, SpawnSkin, SpawnX, SpawnZ, SpawnY, SpawnA, 0, 0, 0, 0, 0, 0);
        SpawnPlayer(playerid);
        printf("test2: %i", SpawnSkin);
       
        SetPlayerPos(playerid, SpawnX, SpawnY, SpawnZ);
        SetPlayerFacingAngle(playerid, SpawnA);
        SetPlayerSkin(playerid, SpawnSkin);
        SetPlayerInterior(playerid, SpawnInt);
        SetPlayerVirtualWorld(playerid, SpawnWorld);
        printf("test 3: %i", SpawnSkin);
    }
    else
    {
        SendClientMessage(playerid, ORANGE, "You're account already exsists. Relog and complete your login.");
        Kick(playerid);
    }
    return 1;
}
And post the prints.
All four said 59
Reply
#3

Still need help with this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)