Saving/loading skin with DUDB? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Saving/loading skin with DUDB? (
/showthread.php?tid=85615)
Saving/loading skin with DUDB? -
Anarkien - 08.07.2009
I try to make a clothes system for my newly started server. I use DUDB for the saving/loading part.
I just wonder, how can I code a system that saves the skinID when the player logs out, and then loads it again whenever the player comes online?
dcm_login:
pawn Код:
if (udb_CheckLogin(PlayerName(playerid),params)) {
GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
SetPlayerSkin(playerid,dUserINT(PlayerName(playerid)).("skin"));
OnPlayerDisconnect:
pawn Код:
public OnPlayerDisconnect(playerid) {
if (PLAYERLIST_authed[playerid]) {
dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid));
dUserSetINT(PlayerName(playerid)).("skin",GetPlayerSkin(playerid));
}
PLAYERLIST_authed[playerid]=false;
return false;
}
When I edit the "Money" part in the userfile and I log on, the money counter will go up to the given "money" number in the file.
But when I try to edit the "Skin" part, there's no change when I log on, I still spawn with CJ skin.
So how can I make this right?
This is in the Username.dudb file:
pawn Код:
password_hash=xxxxxxx
money=50000
skin=293
So when I try to go IG I'll get 50000, but not skinID 293.
Re: Saving/loading skin with DUDB? -
Anarkien - 08.07.2009
It's weird that it won't load the skinID when it loads everything else I've tried..
Any suggestions on what I can do about this?
And just a fast question: is DUDB just as good as INI?
Re: Saving/loading skin with DUDB? -
Anarkien - 08.07.2009
Can't anyone help me out with this?
Re: Saving/loading skin with DUDB? -
Naruto4 - 07.01.2010
i have the same problem.Can anyone help us ?
Re: Saving/loading skin with DUDB? -
Calon - 07.01.2010
Use SetSpawnInfo() to set the skin, for when the player spawns (though it sometimes doesn't set the skin). Don't (whatever you do) use SetPlayerSkin() in OnPlayerSpawn(), it leads to a substantial amount of crashes (supposed to be fixed in 0.2, but still happens).