PDA

View Full Version : An issue with GetPlayerPos and GetPlayerSkin.


Jack.7331
24/07/2013, 01:37 PM
Right, I've been making a test gamemode and everything works fine apart from saving and spawning - everything saves but the skins and positions.

Upon login,
LoadPlayerInformation(playerid);
if(strcmp(inputtext, SavedInfo[playerid][Password], false) == 0)
{
if(SavedInfo[playerid][Tutorial] == 0) StartTests(playerid);

SetSpawnInfo(playerid, 0, SavedInfo[playerid][Skin], SavedInfo[playerid][PosX], SavedInfo[playerid][PosY], SavedInfo[playerid][PosZ], 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerSkin(playerid, SavedInfo[playerid][Skin]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
}

Upon saving,
stock SavePlayerInformation(playerid)
{
if(IsPlayerConnected(playerid))
{
new PlayerFile[ MAX_PLAYER_NAME + 12 ];
format(PlayerFile, sizeof PlayerFile, "Accounts/%s.ini", GetPlayerNameEx(playerid));



dini_Set(PlayerFile, "Password", SavedInfo[playerid][Password]);
dini_Set(PlayerFile, "Accent", SavedInfo[playerid][Accent]);

dini_IntSet(PlayerFile, "Tutorial", SavedInfo[playerid][Tutorial]);
dini_IntSet(PlayerFile, "Age", SavedInfo[playerid][Age]);
dini_IntSet(PlayerFile, "Gender", SavedInfo[playerid][Gender]);
dini_IntSet(PlayerFile, "Money", SavedInfo[playerid][Money]);
dini_IntSet(PlayerFile, "IncorrectAnswers", SavedInfo[playerid][IncorrectAnswers]);
dini_IntSet(PlayerFile, "AdminLevel", SavedInfo[playerid][AdminLevel]);

dini_IntSet(PlayerFile, "Skin", GetPlayerSkin(playerid));

dini_FloatSet(PlayerFile, "PosX", SavedInfo[playerid][PosX]);
dini_FloatSet(PlayerFile, "PosY", SavedInfo[playerid][PosY]);
dini_FloatSet(PlayerFile, "PosZ", SavedInfo[playerid][PosZ]);

dini_IntSet(PlayerFile, "HouseID", SavedInfo[playerid][HouseID]);
dini_IntSet(PlayerFile, "BusinessID", SavedInfo[playerid][BusinessID]);

dini_IntSet(PlayerFile, "Money", SavedInfo[playerid][Money]);
printf("%s's account has been saved.", GetPlayerNameEx(playerid));
}
}

Upon loading a player's information,

stock LoadPlayerInformation(playerid)
{
new PlayerFile[ MAX_PLAYER_NAME + 12 ];
format(PlayerFile, sizeof PlayerFile, "Accounts/%s.ini", GetPlayerNameEx(playerid));

format(SavedInfo[playerid][Password], 15, dini_Get(PlayerFile, "Password"));
format(SavedInfo[playerid][Accent], 50, dini_Get(PlayerFile, "Accent"));

SavedInfo[playerid][Tutorial] = dini_Int(PlayerFile, "Tutorial");
SavedInfo[playerid][Age] = dini_Int(PlayerFile, "Age");
SavedInfo[playerid][Gender] = dini_Int(PlayerFile, "Gender");
SavedInfo[playerid][Money] = dini_Int(PlayerFile, "Money");

SavedInfo[playerid][PosX] = dini_Float(PlayerFile, "PosX");
SavedInfo[playerid][PosY] = dini_Float(PlayerFile, "PosY");
SavedInfo[playerid][PosZ] = dini_Float(PlayerFile, "PosZ");
SetPlayerPos(playerid, SavedInfo[playerid][PosX], SavedInfo[playerid][PosY], SavedInfo[playerid][PosZ]);

SavedInfo[playerid][AdminLevel] = dini_Int(PlayerFile, "AdminLevel");

SavedInfo[playerid][IncorrectAnswers] = dini_Int(PlayerFile, "IncorrectAnswers");

SavedInfo[playerid][Money] = dini_Int(PlayerFile, "Money");
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, SavedInfo[playerid][Money]);

SavedInfo[playerid][HouseID] = dini_Int(PlayerFile, "HouseID");

SavedInfo[playerid][Skin] = dini_Int(PlayerFile, "Skin");
SetPlayerSkin(playerid, SavedInfo[playerid][Skin]);
}

I can't seem to find what's doing it.