07.08.2012, 22:39
Код:
if (dialogid == DIALOG_REGISTER) { 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, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{00FF00}Welcome {cacaca}- {00FF00}Register", "{00FF00}Welcome! {cacaca}This account isn't {FF0000}registered!\n{cacaca}Please input your password to {00FF00}register!", "Register", "Quit"); dini_Create(file); dini_IntSet(file, "Password", udb_hash(inputtext)); dini_IntSet(file, "Admin", PlayerInfo[playerid][pAdmin] = 0); dini_IntSet(file, "Duty", PlayerInfo[playerid][aDuty] = 0); dini_IntSet(file, "Tog", PlayerInfo[playerid][aTog] = 0); dini_IntSet(file, "Rank", PlayerInfo[playerid][pRank] = 0); dini_IntSet(file, "Banned", PlayerInfo[playerid][pBanned] = 0); dini_IntSet(file, "DonateRank", PlayerInfo[playerid][pDonateRank] = 0); dini_IntSet(file, "Warnings", PlayerInfo[playerid][pWarns] = 0); dini_IntSet(file, "Jail", PlayerInfo[playerid][pJail] = 0); dini_IntSet(file, "JailTime", PlayerInfo[playerid][pJailTime] = 0); dini_IntSet(file, "Cash", PlayerInfo[playerid][pCash] = 50000); dini_IntSet(file, "Reg", PlayerInfo[playerid][pReg] = 0); dini_IntSet(file, "Kills", PlayerInfo[playerid][pKills] = 0); dini_IntSet(file, "Deaths", PlayerInfo[playerid][pDeaths] = 0); dini_IntSet(file, "Gun0", PlayerInfo[playerid][pGun0] = 0); dini_IntSet(file, "Gun1", PlayerInfo[playerid][pGun1] = 0); dini_IntSet(file, "Gun2", PlayerInfo[playerid][pGun2] = 0); dini_IntSet(file, "Gun3", PlayerInfo[playerid][pGun3] = 0); dini_IntSet(file, "Gun4", PlayerInfo[playerid][pGun4] = 0); dini_IntSet(file, "Gun5", PlayerInfo[playerid][pGun5] = 0); dini_IntSet(file, "Gun6", PlayerInfo[playerid][pGun6] = 0); dini_IntSet(file, "Gun7", PlayerInfo[playerid][pGun7] = 0); dini_IntSet(file, "Gun8", PlayerInfo[playerid][pGun8] = 0); dini_IntSet(file, "Gun9", PlayerInfo[playerid][pGun9] = 0); dini_IntSet(file, "Gun10", PlayerInfo[playerid][pGun10] = 0); dini_IntSet(file, "Gun11", PlayerInfo[playerid][pGun11] = 0); dini_IntSet(file, "Gun12", PlayerInfo[playerid][pGun12] = 0); dini_IntSet(file, "Model", PlayerInfo[playerid][pModel] = 0); dini_IntSet(file, "Muted", PlayerInfo[playerid][pMuted] = 0); dini_IntSet(file, "tMuted", PlayerInfo[playerid][ptMuted] = 0); dini_IntSet(file, "vMuted", PlayerInfo[playerid][pvMuted] = 0); dini_IntSet(file, "Spree", PlayerInfo[playerid][pSpree] = 0); dini_IntSet(file, "CWons", PlayerInfo[playerid][pCWons] = 0); dini_IntSet(file, "Lotto", PlayerInfo[playerid][pLotto] = 0); dini_IntSet(file, "Hide", PlayerInfo[playerid][pHide] = 0); dini_IntSet(file, "Arrested", PlayerInfo[playerid][pArrested] = 0); dini_IntSet(file, "Crimes", PlayerInfo[playerid][pCrimes] = 0); dini_IntSet(file, "WantedDeaths", PlayerInfo[playerid][pWantedDeaths] = 0); format(string, 128, "{cacaca}|- [SYSTEM]: You succesfully registered the nickname {00FF00}%s {cacaca}with password {00FF00}%s {cacaca}-|", name, inputtext); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{00FF00}Welcome! {cacaca}- {00FF00}Login", "{00FF00}Welcome Back! {cacaca}This account is {FF0000}registered!\n{cacaca}Please input your password to {00FF00}login!", "Login", "Quit"); } if (dialogid == DIALOG_LOGIN) { 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, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{00FF00}Welcome Back! {cacaca}- {00FF00}Login", "{00FF00}Welcome Back! {cacaca}This account is {FF0000}registered!\n{cacaca}Please input your password to {00FF00}login!", "Login", "Quit"); new tmp; tmp = dini_Int(file, "Password"); if(udb_hash(inputtext) != tmp) { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{00FF00}Welcome Back! {cacaca}- {FF0000}Login", "{00FF00}Welcome Back! {cacaca}This account is {FF0000}registered!\n{cacaca}Please input your password to {00FF00}login!", "Login", "Quit"); } else { PlayerInfo[playerid][pAdmin] = dini_Int(file, "Admin"); GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid)); PlayerInfo[playerid][pModel] = GetPlayerSkin(playerid); SpawnPlayer(playerid); } } return 0; }