Unknown bug.
#1

Код:
Hi there.

So I created my gamemode, and it worked with 0.3c, I paused developing for few months, and then 0.3d was released, I decided to continue developing, but I found one very big bug.

When player enters his/her password, server just kick player out.

Here is login code:

pawn Код:
public LoginPlayer(const PlayerName[], const PlayerPassword[]){    new Login_String[128], pass, pass_new[128], id;    GetPlayerIDByName(PlayerName, id);    if(WrongPassword[id] == 3){        SendClientMessage(id, COLOR_RED, "You have type wrong password for three times, you have been kicked");        Kick(id);        return 1;    }    format(Login_String, 128, "Players/%s.ini", PlayerName);    if(!dini_Exists(Login_String)){        SendClientMessage(id, COLOR_RED, "Username is not registered, please register.");        return 1;    }    pass = dini_Int(Login_String, "Key");    format(pass_new, sizeof(pass_new), "%s", PlayerPassword);    if(udb_hash(pass_new) != pass){        SendClientMessage(id, COLOR_RED, "Wrong password.");        ShowPlayerDialog(id, 1, 1, "Login", "Wrong password please try again", "Login", "Close");        WrongPassword[id]++;        return 1;    }       SpawnPlayer(id);
and here is OnPlayerRequestSpawn
pawn Код:
public OnPlayerRequestSpawn(playerid){    if(PlayerLogedIn[playerid] != 1){        SendClientMessage(playerid, COLOR_RED, "You need to login first.");        return 0;    }else{        return 1;    }}
and here is onplayerspawn

pawn Код:
public OnPlayerSpawn(playerid){    if(Player_Infos[playerid][pTutorial] == 999){        TutorialStep1(playerid);        return 0;    }    new spawn_string[128];    if(Player_Infos[playerid][pAdministrator] >= 1338){        format(spawn_string, sizeof(spawn_string), "Welcome back owner %s", Player_Infos[playerid][pName]);        SendClientMessage(playerid, COLOR_BLUE, spawn_string);    }    SetPlayerCash(playerid, Player_Infos[playerid][pCash]);    SetPlayerSkin(playerid, Player_Infos[playerid][pSkin]);    SetPlayerPos(playerid, Player_Infos[playerid][pSpawn_X], Player_Infos[playerid][pSpawn_Y], Player_Infos[playerid][pSpawn_Z]);    SetPlayerInterior(playerid, Player_Infos[playerid][pInterior]);    return 1;}
FIXED, if you have same problem, add SetSpawnInfo before SpawnPlayer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)