if(dialogid == DIALOG_LOGIN) { if(!response) { Kick(playerid); } if(response) { //if(strcmp(PlayerInfo[playerid][pPass], inputtext, true, 129)) if(strcmp(inputtext, PlayerInfo[playerid][pPass], false)) { new Query[500]; mysql_real_escape_string(PlayerInfo[playerid][Nick], PlayerInfo[playerid][Nick]); mysql_format(mysql, Query, sizeof(Query), "SELECT * FROM `playerdata` WHERE `nick` = '%s' LIMIT 1", PlayerInfo[playerid][Nick]); mysql_tquery(mysql, Query, "OnAccountLoad", "i", playerid); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{FFFFFF}BCRP - Login","{F81414}You have entered an incorrect password.\n{FFFFFF}Type your password below to login.","Login","Quit"); } } }
SELECT * FROM `playerdata` WHERE `nick` = '' LIMIT 1 // This is 52 characters long. // Add 24 characters to it (the name, %s) SELECT * FROM `playerdata` WHERE `nick` = '%s' LIMIT 1 // 52 + 24 = 76 // Add 1 for the EOS, and it's 77 now
if(strcmp(inputtext, PlayerInfo[playerid][pPass], false))
if(strlen(inputtext) > 0 && strcmp(inputtext, PlayerInfo[playerid][pPass], false) == 0)
pawn Код:
pawn Код:
|
if (strcmp(string, string2) == 0) { // The strings match } else { // The strings don't match }
Код:
if (strcmp(string, string2) == 0) { // The strings match } else { // The strings don't match } |
public OnAccountCheck(playerid) { SetPlayerCameraPos(playerid, -192.3700, 883.2700, 13.7500); SetPlayerCameraLookAt(playerid, -192.6300, 884.2400, 13.8200); SetPlayerPos(playerid, -195.7553, 895.5865, 8.6920); new rows, fields, string[128]; cache_get_data(rows, fields, mysql); if(rows) { new tmp[129]; cache_get_field_content(0, "Password", tmp); format(PlayerInfo[playerid][pPass], 129, "%s", tmp); //cache_get_field_content(0, "password", PlayerInfo[playerid][pPass], mysql, 129); format(string, sizeof(string), "Welcome back %s!\n\nPlease type in your password to log back into the server!", GetNameEx(playerid)); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "BCRP - Login", string, "Login", "Quit"); } else { format(string, sizeof(string), "Welcome %s!\n\nWe have noticed you do not have an account registered with us!\nPlease type a password to register a new account:", GetNameEx(playerid)); ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "BCRP - Register", string, "Register", "Quit"); } return 1; }