Saving Skin/Position
#1

I'm having an issue. I'm new to using Dini/any saving stats thing period. I created a register and login out of a dialog using Dini. I added to that it saves everything. Anything in my enum pInfo such as "Faction" or "BankMoney" saves, but Skin and Position do not save. Here is the code I'm using to save and load:

OnPlayerDisconnect:

Code:
PlayerInfo[playerid][Skin] = GetPlayerSkin(playerid);
dini_IntSet(file,"Skin", PlayerInfo[playerid][Skin]);
When the player logs in:

Code:
SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
I did the same thing with money, and money saves perfectly. Can anyone help me with this?
Reply
#2

Remember to load the skin when the person logs into his account.

Code:
PlayerInfo[playerid][Skin] = dini_Int(file, "Skin");
Reply
#3

Yeah I have that, just forgot to put it in the main post.

pawn Code:
PlayerInfo[playerid][Skin] = dini_Int(file, "Skin");
Reply
#4

Hmm, I can't realy understand why the Skin won't save, as I'm using the same method - and that works 100%.

For the Position - I use this:

In you Playerinfo enum:
Code:
Float:pPosX,
Float:pPosY,
Float:pPosZ,
Under your Login Function
Code:
pInfo[playerid][pPosX] = dini_Float(File, "PosX");
pInfo[playerid][pPosY] = dini_Float(File, "PosY");
pInfo[playerid][pPosZ] = dini_Float(File, "PosZ");

SetSpawnInfo(playerid, 0, pInfo[playerid][pSkin],pInfo[playerid][pPosX],pInfo[playerid][pPosY],pInfo[playerid][pPosZ],0,0,0,0,0,0,0);
SpawnPlayer(playerid);
Under your Data Save Function
Code:
GetPlayerPos(playerid, pInfo[playerid][pPosX], pInfo[playerid][pPosY], pInfo[playerid][pPosZ]);

dini_FloatSet(File, "PosX", pInfo[playerid][pPosX]);
dini_FloatSet(File, "PosY", pInfo[playerid][pPosY]);
dini_FloatSet(File, "PosZ", pInfo[playerid][pPosZ]);
Tell me if that works.
Reply
#5

I got it to work, just needed to make it occur AFTER the player spawns, because it was by default giving me the CJ skin stuff.
Reply
#6

Quote:
Originally Posted by TKZ227
View Post
I got it to work, just needed to make it occur AFTER the player spawns, because it was by default giving me the CJ skin stuff.
Yea you need to place it under OnPlayerSpawn
Reply
#7

PHP Code:
 SetPlayerSkin(playeridPlayerInfo[playerid][pChar]); 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)