23.06.2013, 10:22
Код:
//-----[OnDialogResonse]----- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch( dialogid ) { case 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, "{ffd700}:: {ffffff}Inregistrare", "Bine ai venit! \n\nNu esti inregistrat pe acest server! \nIntrodu parola dorita in casuta urmatoare.", "Continua", "Iesire"); dini_Create(file); dini_IntSet(file, "Key", PlayerInfo[playerid][pKey] = udb_hash(inputtext)); dini_IntSet(file, "Score", PlayerInfo[playerid][pScore] = 0); dini_IntSet(file, "Cash", PlayerInfo[playerid][pCash] = 40000); dini_IntSet(file, "Kills", PlayerInfo[playerid][pKills] = 0); dini_IntSet(file, "Deaths", PlayerInfo[playerid][pDeaths] = 0); dini_IntSet(file, "Admin", PlayerInfo[playerid][pAdmin] = 0); dini_IntSet(file, "Donate", PlayerInfo[playerid][pDonate] = 0); dini_IntSet(file, "Origin", PlayerInfo[playerid][pOrigin] = 0); dini_IntSet(file, "Muted", PlayerInfo[playerid][pMuted] = 0); dini_IntSet(file, "Warns", PlayerInfo[playerid][pWarns] = 0); dini_IntSet(file, "Jailed", PlayerInfo[playerid][pJailed] = 0); dini_IntSet(file, "JailTime", PlayerInfo[playerid][pJailTime] = 0); dini_IntSet(file, "Food", PlayerInfo[playerid][pFood] = 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, "Ammo1", PlayerInfo[playerid][pAmmo1] = 0); dini_IntSet(file, "Ammo2", PlayerInfo[playerid][pAmmo2] = 0); dini_IntSet(file, "Ammo3", PlayerInfo[playerid][pAmmo3] = 0); dini_IntSet(file, "Ammo4", PlayerInfo[playerid][pAmmo4] = 0); dini_IntSet(file, "Ammo5", PlayerInfo[playerid][pAmmo5] = 0); format(string, 128, "SERVER: %s, te-ai inregistrat cu succes! Ai fost logat automat.", name, inputtext); SendClientMessage(playerid, -1, string); SendClientMessage(playerid, -1, "SERVER: Nu uita sa arunci o privire pe forum: {ffd700}vd.info/forum"); gPlayerLogged[playerid] = 1; GivePlayerMoney(playerid, 40000); // class selection init vars // start the tutorial gPlayerCitySelection[playerid] = -1; gPlayerHasCitySelected[playerid] = 0; gPlayerLastCitySelectionTick[playerid] = GetTickCount(); } case 2: { 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, 2, DIALOG_STYLE_INPUT, "{ffd700}:: {ffffff}Login [1/3]", "Bine ai revenit! \n\nAcest nume este deja inregistrat! \nPentru a te loga introdu parola contului in casuta urmatoare.", "Login", "Iesire"); new tmp; tmp = dini_Int(file, "Key"); if(udb_hash(inputtext) != tmp) { if(gLoginFail[playerid] == 3) { Ban(playerid); } else { gLoginFail[playerid]++; new fails, msg, titlestring[64]; if (gLoginFail[playerid] == 0) { fails = 1; } else if (gLoginFail[playerid] == 1) { fails = 2; } else if (gLoginFail[playerid] == 2) { fails = 3; } if (gLoginFail[playerid] == 0) { msg = 3; } else if (gLoginFail[playerid] == 1) { msg = 2; } else if (gLoginFail[playerid] == 2) { msg = 1; } format(titlestring, sizeof(titlestring), "{ffd700}:: {ffffff}Login [%d/3]", fails); format(string, sizeof(string), "{ffd700}*{ffffff} Parola introdusa este gresita. Mai ai {ffd700}%d{ffffff} incercari", msg); SendClientMessage(playerid, -1, string); ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, titlestring, "Bine ai revenit! \n\nAcest nume este deja inregistrat! \nPentru a te loga introdu parola contului in casuta urmatoare.", "Login", "Iesire"); } } else { gPlayerLogged[playerid] = 1; PlayerInfo[playerid][pScore] = dini_Int(file, "Score"); SetPlayerScore(playerid, PlayerInfo[playerid][pScore]); PlayerInfo[playerid][pCash] = dini_Int(file, "Cash"); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); PlayerInfo[playerid][pKills] = dini_Int(file, "Kills"); PlayerInfo[playerid][pDeaths] = dini_Int(file, "Deaths"); PlayerInfo[playerid][pAdmin] = dini_Int(file, "Admin"); PlayerInfo[playerid][pDonate] = dini_Int(file, "Donate"); PlayerInfo[playerid][pOrigin] = dini_Int(file, "Origin"); PlayerInfo[playerid][pMuted] = dini_Int(file, "Muted"); PlayerInfo[playerid][pWarns] = dini_Int(file, "Warns"); PlayerInfo[playerid][pJailed] = dini_Int(file, "Jailed"); PlayerInfo[playerid][pJailTime] = dini_Int(file, "JailTime"); PlayerInfo[playerid][pFood] = dini_Int(file, "Food"); PlayerInfo[playerid][pGun1] = dini_Int(file, "Gun1"); PlayerInfo[playerid][pGun2] = dini_Int(file, "Gun2"); PlayerInfo[playerid][pGun3] = dini_Int(file, "Gun3"); PlayerInfo[playerid][pGun4] = dini_Int(file, "Gun4"); PlayerInfo[playerid][pGun5] = dini_Int(file, "Gun5"); PlayerInfo[playerid][pAmmo1] = dini_Int(file, "Ammo1"); PlayerInfo[playerid][pAmmo2] = dini_Int(file, "Ammo2"); PlayerInfo[playerid][pAmmo3] = dini_Int(file, "Ammo3"); PlayerInfo[playerid][pAmmo4] = dini_Int(file, "Ammo4"); PlayerInfo[playerid][pAmmo5] = dini_Int(file, "Ammo5"); SendClientMessage(playerid, -1, "SERVER: Te-ai logat cu succes!"); SendClientMessage(playerid, -1, "SERVER: Nu uita sa arunci o privire pe forum: {ffd700}vd.info/forum"); // install weapons new Gun1 = PlayerInfo[playerid][pGun1]; new Gun2 = PlayerInfo[playerid][pGun2]; new Gun3 = PlayerInfo[playerid][pGun3]; new Gun4 = PlayerInfo[playerid][pGun4]; new Gun5 = PlayerInfo[playerid][pGun5]; new Ammo1 = PlayerInfo[playerid][pAmmo1]; new Ammo2 = PlayerInfo[playerid][pAmmo2]; new Ammo3 = PlayerInfo[playerid][pAmmo3]; new Ammo4 = PlayerInfo[playerid][pAmmo4]; new Ammo5 = PlayerInfo[playerid][pAmmo5]; if(Gun1 != 0) { GivePlayerWeapon(playerid, Gun1, Ammo1); } if(Gun2 != 0) { GivePlayerWeapon(playerid, Gun2, Ammo2); } if(Gun3 != 0) { GivePlayerWeapon(playerid, Gun3, Ammo3); } if(Gun4 != 0) { GivePlayerWeapon(playerid, Gun4, Ammo4); } if(Gun5 != 0) { GivePlayerWeapon(playerid, Gun5, Ammo5); } SpawnPlayer(playerid); } return 1; } } return 1; }