SAMP Server Crash
#1

My SAMP server crashes when I login in to my account and SELECT * from database. Here's the MySQL Login function.
Код:
stock MySQL_Login(playerid)
{
    new query[300], pname[24], savingstring[20];
    GetPlayerName(playerid, pname, 24);
    format(query, sizeof(query), "SELECT * FROM playerdata WHERE user = '%s'", pname);
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row_format(query,"|"))
    {
        mysql_get_field("score", savingstring); SetPlayerScore(playerid, strval(savingstring));
        mysql_get_field("money", savingstring); MoneyGiven[playerid] = strval(savingstring);
    }
    mysql_free_result();
    SendClientMessage(playerid, -1, "You have been logged in!");
    Logged[playerid] = 1;
    return 1;
}
and OnPlayerConnect(playerid)
Код:
public OnPlayerConnect(playerid)
{
    MoneyGiven[playerid] = 0;
    new query[200], pname[24];
    GetPlayerName(playerid, pname, 24);
    format(query, sizeof(query), "SELECT IP FROM `playerdata` WHERE user = '%s' LIMIT 1", pname);
    mysql_query(query);
    mysql_store_result();
    new rows = mysql_num_rows();
    if(rows != 1)
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register","Your user is {FF0000}not{FFFFFF} registered! Please {0000FF}register{FFFFFF} with a password below!","Register","Cancel");
    }
    if(rows == 1)
    {
        new IP[2][16];
        mysql_fetch_field_row(IP[0],"IP");
        GetPlayerIp(playerid, IP[1], 16);
        if(strlen(IP[0]) != 0 && !strcmp(IP[0], IP[1], true))
        {
            MySQL_Login(playerid);
        }
        else if(!strlen(IP[0]) || strcmp(IP[0], IP[1], true))
        {
            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login","Your user is {FF0000}registered{FFFFFF}! Please {0000FF}login{FFFFFF} with your password below!","Login","Cancel");
            IsRegistered[playerid] = 1;
        }
    }
    mysql_free_result();
    return 1;
}
If I change * to password it doesn't crash, but it obviously wont load my score or money. But again if I set it to password, money, score it crashes aswell.
Reply


Messages In This Thread
SAMP Server Crash - by WilliamOordt - 16.06.2015, 03:10
Re: SAMP Server Crash - by bgedition - 16.06.2015, 03:21

Forum Jump:


Users browsing this thread: 1 Guest(s)