SA-MP Forums Archive
[HELP] Skins & Guns are saving, but not loading. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] Skins & Guns are saving, but not loading. (/showthread.php?tid=548567)



[HELP] Skins & Guns are saving, but not loading. - BornHuman - 30.11.2014

I'm having a bit of an issue, to be honest. I don't USUALLY come to the SA:MP forums for help because I like to learn from my mistakes and fix it myself, but this time, even with searching - I haven't found a single answer that comes close to helping me. I've recently created my own dini saving system, and everything seems to be working fine- but Skins and Weapons. And I'm not really sure why. I've placed them on an enumerator, WepSlot0, WepSlot1, etc, and LastSkin, just like I've done with health, and coordinates, but there's an issue here.

When I get in game, and my admin level loads up, I /setskin, and /givegun. I /q, and I check my file. These /are/ there. WepSlot1=24 (desert eagle), LastSkin=294. However, when the player logs in through the dialog OnPlayerLogin is called (one of my functions) which then initially reads from the file, and sets the player's data. Like stated above, I can /setskin and /q and my file will say 294 for my skin, which is what I set it too. What is really wierd is when I log in, it sets it to 811951215.

I hope you understand the problem, now here's the code:

pawn Код:
Player[playerid][LastSkin] = dini_Int(string, "LastSkin");
//This is what the skin loads from, the dini file.
This shouldn't change the number of the skin in the file at all. Even the slightest bit. In fact, it should store it. Which makes me beleive that I shouldn't be using dini_Int, but I know that a skin is an integer. I don't understand.

REP+ and an internet cookie to anyone who can help me figure this out.


Re: [HELP] Skins & Guns are saving, but not loading. - BornHuman - 30.11.2014

Also, with guns, it's basically the same thing. I have a callback for the server to give someone their weapons and I even tried to debug the issue by printing in the console what it has saved. It uses the function GivePlayerWeapon(playerid, Player[playerid][WepSlot0], 99999); which should give them their weapons but it does not.


Re: [HELP] Skins & Guns are saving, but not loading. - UltraScripter - 30.11.2014

try this
onplayerdisconnect
pawn Код:
dini_IntSet(youfile, "skin", GetPlayerSkin(playerid));
onplayerspawn
pawn Код:
new skin;
skin = dini_Int(yourfile, "skin");
SetPlayerSkin(playerid, skin);
it should work !.


Re: [HELP] Skins & Guns are saving, but not loading. - BornHuman - 30.11.2014

Quote:
Originally Posted by UltraScripter
Посмотреть сообщение
try this
onplayerdisconnect
pawn Код:
dini_IntSet(youfile, "skin", GetPlayerSkin(playerid));
onplayerspawn
pawn Код:
new skin;
skin = dini_Int(yourfile, "skin");
SetPlayerSkin(playerid, skin);
it should work !.
Nope:

LastSkin=811951215


Re: [HELP] Skins & Guns are saving, but not loading. - UltraScripter - 30.11.2014

did you add something or change?


Re: [HELP] Skins & Guns are saving, but not loading. - BornHuman - 30.11.2014

Quote:
Originally Posted by UltraScripter
Посмотреть сообщение
did you add something or change?
Nope.


Re: [HELP] Skins & Guns are saving, but not loading. - sammp - 30.11.2014

Player[playerid][Skin] -< Is it an integer or a string?


Re: [HELP] Skins & Guns are saving, but not loading. - BornHuman - 30.11.2014

It saves as an integer, and I'm pretty sure skins are integers.