- 0
Problema logare
-
Similar Content
-
Cum adaug melodie pe timpul logarii? cand se logheaza playerii sa cante o anumita piesa
By Decisivul,
- 2 replies
- 170 views
-
- 1 answer
- 237 views
-
- 3 answers
- 355 views
-
- 3 replies
- 403 views
-
- 1 reply
- 353 views
-
-
Recently Browsing 0 members
- No registered users viewing this page.
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; }
Link to comment
Share on other sites
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.