SA-MP Forums Archive
SpawnPlayer problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SpawnPlayer problem (/showthread.php?tid=262302)



SpawnPlayer problem - eXtrike - 17.06.2011

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?