19.09.2015, 15:28
Try this out
Also it looks like you're calling empity queries at some point, you should find and stop calling them.
pawn Код:
if(dialogid == 12345)
{
if(!IsPlayerConnected(playerid)) return 1;
if(!response) return SendClientMessage(playerid, COLOR_WHITE, "{0066FF}Info: {FFFFFF}Ai fost dat afara pentru ca nu ai acceptat inregistrarea."), Kick(playerid), 1;
if(strlen(inputtext) < 4 || strlen(inputtext) > 70) return ShowPlayerDialog(playerid,12347,DIALOG_STYLE_PASSWORD,"{FFFFFF}Inregistrare","{FFFFFF}Scrie {0066FF}parola contului tau {FFFFFF}mai jos:","Inregistrare","Iesi");
new name[MAX_PLAYER_MAME];
GetPlayerName(playerid, name, sizeof(name));
if(MySQLCheckAccount(name) != -1) return SendClientMessage(playerid, COLOR_WHITE, " "), SendClientMessage(playerid, COLOR_WHITE, "{0066FF}Info: {FFFFFF}Acel nume este deja folosit, alege altul.");
new tmppass[64];
mysql_real_escape_string(inputtext, tmppass);
if(strlen(tmppass) < 4)
{
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_PASSWORD,"{FFFFFF}Logare","{FFFFFF}Scrie {0066FF}parola contului tau {FFFFFF}mai jos:","Logare","Iesi");
if(++gPlayerLogTries[playerid] >= 5) return Kick(playerid);
}
OnPlayerRegister(playerid, tmppass);
}
forward MySQLCheckAccount(sqlplayersname[]);
public MySQLCheckAccount(sqlplayersname[])
{
new query[ 256 ];
mysql_format( handle, query, sizeof( query ), "SELECT `id` from `players` WHERE `username` = '%e' LIMIT 1;", sqlplayersname );
new Cache:r = mysql_query( handle, query );
new value;
if( !cache_num_rows() ) value = -1;
else value = cache_get_field_content_int( 0, "id" );
cache_delete(r);
return value;
}