13.09.2009, 12:52
I was trying to study dudb. After reading the tutorials, I tried to make a basic saveskin command along with the user system in the tut. It seems 50% working because, it saves the Skin ID to file. But every time I do /saveskin and then rejoin, it sets my skin to some random one. I guess its because the skin id value gets overwriting each time when I do /saveskin or something like that..can't sort it out
Please help
Heres the code:
Please help
Heres the code:
Код:
dcmd_login(playerid,params[]) { if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"Already authed."); if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account doesn't exist, please use '/register password'."); if (strlen(params)==0) return SystemMsg(playerid,"Correct usage: '/login password'"); if (udb_CheckLogin(PlayerName(playerid),params)) { GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid)); SetPlayerSkin(playerid,dUserINT(PlayerName(playerid)).("Skin")-GetPlayerSkin(playerid)); PLAYERLIST_authed[playerid]=true; return SystemMsg(playerid,"Successfully authed!"); } return SystemMsg(playerid,"Login failed!"); } dcmd_saveskin(playerid, params[]) { #pragma unused params if (PLAYERLIST_authed[playerid]) { dUserSetINT(PlayerName(playerid)).("Skin",GetPlayerSkin(playerid)); SendClientMessage(playerid, Green, "You have successfully saved your skin!"); } else SendClientMessage(playerid, Red, "Error: Please login and try again!"); return 1; }