30.08.2010, 13:54
Money Don't save please help me!
Register and login
On Player Disconnect
Код:
enum pInfo { pAdminLevel, pCash, pScore, } new PlayerInfo[MAX_PLAYERS][pInfo];
Код:
if (dialogid == 1) { new name[MAX_PLAYER_NAME], file[256], string[128]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(!response) return Kick(playerid); if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "B.E.G Wars v0.8 - by Hor1z0n", "Hi,you're not registred.Type your password in the box to register", "Register", "Quit"); dini_Create(file); dini_IntSet(file, "Password", udb_hash(inputtext)); dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0); dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 20000); dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0); GivePlayerMoney(playerid, 20000); format(string, 128, "[B.E.G]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext); SendClientMessage(playerid, COLOR_YELLOW, string); gPlayerLogged[playerid] = 1; } if (dialogid == 2) { new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(!response) return Kick(playerid); if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "B.E.G Wars v0.8 - by Hor1z0n", "You're registred on this server.Please type your password to login", "Login", "Quit"); new tmp; tmp = dini_Int(file, "Password"); if(udb_hash(inputtext) != tmp) { SendClientMessage(playerid, COLOR_RED, "Wrong Password."); ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "B.E.G Wars v0.8 - by Hor1z0n", "You're registred on this server.Please type your password to login", "Login", "Quit"); } else { gPlayerLogged[playerid] = 1; PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel"); SetPlayerScore(playerid, PlayerInfo[playerid][pScore]); GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid)); SendClientMessage(playerid,COLOR_RED, "B.E.G Wars: Welcome on Beg Wars version 0.8 by Hor1z0n!"); } }
Код:
new name[MAX_PLAYER_NAME], file[256]; new string[128]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(gPlayerLogged[playerid] == 1) { dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]); dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]); dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]); }