SpawnPlayer problem
#1

pawn Код:
public OnPlayerLogin(playerid,password[])
{
    new
        loginstring[ 256 ],    playername2[MAX_PLAYER_NAME]
    ;
    GetPlayerName(playerid, playername2, sizeof(playername2));
    new string[ 400 ] ;
    format(string,400,"SELECT * FROM `players` WHERE `username` = '%s' AND `password` = '%s'",ReturnName(playerid),password);
    mysql_query(string);
    mysql_store_result();
    if(mysql_num_rows() != 0)
    {
        new row[128];
        new field[6][32];

        mysql_fetch_row_format(row, "|");
        explode(row, field, "|");
        mysql_free_result();

        PlayerInfo[playerid][pAdmin] = strval(field[3]);
        PlayerInfo[playerid][pScripter] = strval(field[4]);
        PlayerInfo[playerid][pIP] = strval(field[5]);
    } else {
        format(loginstring,sizeof(loginstring),"{FF0000}WRONG PASSWORD!! {FFFFFF}please write the correct password.",playername2);
        ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"{FFFFFF}Login to the server.",loginstring,"Login", "");
        gPlayerLogTries[playerid] += 1;
        if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
        return 1;
    }
    SpawnPlayer(playerid);
    return 1;
}

public AutoLogin(playerid)
{
    new string[ 400 ] ;
    format(string,400,"SELECT * FROM `players` WHERE `username` = '%s'",ReturnName(playerid));
    mysql_query(string);
    mysql_store_result();
    if(mysql_num_rows() != 0)
    {
        new row[128];
        new field[6][32];

        mysql_fetch_row_format(row, "|");
        explode(row, field, "|");
        mysql_free_result();

        PlayerInfo[playerid][pAdmin] = strval(field[3]);
        PlayerInfo[playerid][pScripter] = strval(field[4]);
        PlayerInfo[playerid][pIP] = strval(field[5]);
    }
    SendClientMessage(playerid, 0xAFAFAFAA, "Ai fost logat");
    SpawnPlayer(playerid);
    return 1;
}
SpawnPlayer don't goes to function AutoLogin, and going to OnPlayerLogin.
What to do?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)