mysql problem
#5

Try this out
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;
}
Also it looks like you're calling empity queries at some point, you should find and stop calling them.
Reply


Messages In This Thread
mysql problem - by Jimmi - 19.09.2015, 10:15
Re: mysql problem - by Jimmi - 19.09.2015, 11:29
Re: mysql problem - by Jimmi - 19.09.2015, 14:06
Re: mysql problem - by Jensenn - 19.09.2015, 14:17
Re: mysql problem - by xVIP3Rx - 19.09.2015, 15:28

Forum Jump:


Users browsing this thread: 1 Guest(s)