01.03.2017, 14:40
Hello, like title. I don't know how to check if the player is registered correctly.
This is my code:
This is my code:
PHP код:
CheckAccountConnection(playerid){
new pName[MAX_PLAYER_NAME], query[512];
GetPlayerName(playerid, pName, sizeof(pName));
mysql_format(MHandle, query, sizeof(query), "SELECT * FROM `character` WHERE `Username` = '%e' LIMIT 1", pName);
mysql_tquery(MHandle, query, "OnCharacterCheck", "i", playerid);
return 1;
}
forward OnCharacterCheck(playerid);
public OnCharacterCheck(playerid){
new rows, szFieldName[MAX_PLAYER_NAME];
cache_get_row_count(rows);
for(new row = 0; row < rows; row++){
cache_get_value(row, "Username", szFieldName);
if(!strcmp(szFieldName, GetPlayerNameEx(playerid))){
cache_get_value(row, "Password", Character[playerid][Password]);
cache_get_value(row, "Username", Character[playerid][Username]);
System_Scm(playerid, COLOR_YELLOW, "LOGIN", "This account was registered.");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Fill your password into the box below.", "Ok", "Cancel");
break;
}
else{
if(row == rows-1){
System_Scm(playerid, COLOR_YELLOW, "REGISTER", "You can register.");
PlayerRegistrationShow(playerid); // This is my registration textdraw.
break;
}
}
}
return 1;
}