- 0
Problema logare
-
Similar Content
-
Recently Browsing 0 members
- No registered users viewing this page.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.
Question
muresan_emanuel2001
De curand am inceput un gamemode de la 0, si am folosit tutorialul de login/register de la "Tutoriale" de pe acest forum.
Singura problema este ca, in momentul in care playerul greseste parola, toate datele se reseteaza, inafara de ID/PAROLA/LEVEL/IP;
respectiv, in momentul in care bag parola corecta dupa ce am bagat parola gresita, se reia procesul de inregistrare.
function OnLogin(playerid) { new rows, fields, temporar[200]; cache_get_data(rows, fields); if(rows) { cache_get_field_content(0, "Parola",temporar), format(playerData[playerid][pPassword], 25, temporar); playerData[playerid][pID] = cache_get_field_content_int(0, "id"); playerData[playerid][pLevel] = cache_get_field_content_int(0, "Level"); playerData[playerid][pAdmin] = cache_get_field_content_int(0, "Admin"); playerData[playerid][pMember] = cache_get_field_content_int(0, "Member"); playerData[playerid][pLeader] = cache_get_field_content_int(0, "Leader"); playerData[playerid][pSkin] = cache_get_field_content_int(0, "Skin"); playerData[playerid][pRegistred] = cache_get_field_content_int(0, "Registred"); playerData[playerid][pAge] = cache_get_field_content_int(0, "Age"); playerData[playerid][pSex] = cache_get_field_content_int(0, "Sex"); playerData[playerid][pCash] = cache_get_field_content_int(0, "Cash"); playerData[playerid][pAdmin] = cache_get_field_content_int(0, "Admin"); printf("%s s-a logat pe server.",GetName(playerid)); SetPlayerScore(playerid, playerData[playerid][pLevel]); SetPlayerSkin(playerid, playerData[playerid][pSkin]); ResetPlayerMoney(playerid); GivePlayerMoney(playerid, playerData[playerid][pCash]); SpawnPlayer(playerid); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Parola incorecta!", "Te rog sa iti introduci parola corecta, pentru a te loga pe server.", "Logare", "Exit");// ii va da dialogul cu mesajul specific. } //ClearChat(playerid); if(playerData[playerid][pRegistred] == 0) { playerData[playerid][pLevel] = 1; Update(playerid, pLevelu); } if(playerData[playerid][pAdmin] >= 1) { SendClientMessage(playerid, COLOR_GRAD2, "[SF:RPG] Te-ai logat pe server ca Administrator."); } if(playerData[playerid][pLeader] >= 1) { new string[256]; format(string, sizeof(string), "[SF:RPG] Ai lider la factiunea %s.", StaticFaction[playerData[playerid][pLeader]][fName]); SendClientMessage(playerid, COLOR_GRAD2, string); } gLogged[playerid] = 1; return 1; }case DIALOG_REGISTER: { if(!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Parola incorecta!", "Introdu-ti o parola pentru a te inregistra pe server! n", "Inregistreaza", "Exit"); mysql_format(handle, query, sizeof(query), "INSERT INTO conturi (Nume, Parola) VALUES ('%s', '%e')", GetName(playerid), inputtext); mysql_query(handle, query); SpawnPlayer(playerid); } return 1; } case DIALOG_LOGIN: { if(!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Parola incorecta!", "Te rog sa iti introduci parola corecta, pentru a te loga pe server.", "Logare", "Exit"); mysql_format(handle, query, sizeof(query), "SELECT * FROM `conturi` WHERE `Nume`='%e' AND `Parola` = '%e'", GetName(playerid),inputtext); mysql_tquery(handle, query, "OnLogin", "i", playerid); } return 1; }0 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now