[HELP] Skins & Guns are saving, but not loading.
#1

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.
Reply
#2

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.
Reply
#3

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 !.
Reply
#4

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
Reply
#5

did you add something or change?
Reply
#6

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)