Saving/loading skin with DUDB?
#1

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

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

Can't anyone help me out with this?
Reply
#4

i have the same problem.Can anyone help us ?
Reply
#5

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).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)