15.07.2014, 21:56
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
And so I begin to load this skin via a callback, called when the player successfully registers their password into the register dialog.
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.
No errors... Any ideas?
REP+
pawn Код:
SpawnSkin = dini_Int("Assets.ini", "SpawnSkin");
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;
}
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;
}
REP+