Problem with spawning
#1

Hello SA-MP Community,

Lately I've continued to script a gamemode from scratch but I ran into a weird problem moments ago. Suddenly, logins don't work. When you join the server, a dialog appears and requires a player to login. When you enter the password, you won't spawn and when you click on the arrows near SPAWN button, the dialog appears again. I've fully debugged my login function and everything seems to be working. I haven't made any changes to my login code for a long time now and this problem occured out of nowhere. When I click on the SPAWN button, it spawns the player with a CJ skin and somewhere in Las Venturas.
Reply
#2

How we can help with out codes , please show us codes of Login and OnPlayerSpawn.
Reply
#3

Quote:
Originally Posted by Shabi RoxX
Посмотреть сообщение
How we can help with out codes , please show us codes of Login and OnPlayerSpawn.
The login dialog:

pawn Код:
case DIALOG_LOGIN: {
       
            if(response) {
           
                new
                    query[128],
                    playerName[MAX_PLAYER_NAME],
                    hashpass[32];
                   
                GetPlayerName(playerid, playerName, sizeof(playerName));
                mysql_real_escape_string(inputtext, hashpass);
                format(query, sizeof(query), "SELECT * FROM `kasutajad` WHERE Nimi='%s' AND Parool=md5('%s')", playerName, hashpass);
                mysql_query(query);
                mysql_store_result();
               
                if(!mysql_num_rows()) {
               
                    SendClientMessage(playerid, -1, ""COLOR_RED"VIGA »"COLOR_WHITE" Teie parool ei klapi, palun kontrollige, et te sisestasite lьnka хige parooli!");
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,
                    "Logi sisse",
                    ""COLOR_GREY"________________________________________________\n\nTeretulemast tagasi "COLOR_ORANGE"Los Angeles Roleplay"COLOR_GREY" serverisse\n\nEt mдngida, peate esmalt sisse logima\n\n"COLOR_GREY"________________________________________________",
                    "Login",
                    "Lahku");
                } else {
               
                    loginPlayer(playerid);
                }
            } else {
           
                SendClientMessage(playerid, -1, ""COLOR_ORANGE"Et mдngida siin serveris te peate sisse logima!");
                Kick(playerid);
            }
        }
The login function:

pawn Код:
stock loginPlayer(playerid) {

    new
        query[128],
        playerName[MAX_PLAYER_NAME],
        holdString[32];
       
    GetPlayerName(playerid, playerName, sizeof(playerName));

    format(query, sizeof(query), "SELECT * FROM `kasutajad` WHERE Nimi='%s'", playerName);
    mysql_query(query);
    mysql_store_result();

    while(mysql_fetch_row_format(query,"|")) {
   
        mysql_fetch_field_row(holdString, "M2ngutunde");        characterInfo[playerid][M2ngutunde] = strval(holdString);
        mysql_fetch_field_row(holdString, "Telefon");           characterInfo[playerid][Telefon] = strval(holdString);
        mysql_fetch_field_row(holdString, "TelefoniNumber");    characterInfo[playerid][TelefoniNumber] = strval(holdString);
        mysql_fetch_field_row(holdString, "Admin");             characterInfo[playerid][Admin] = strval(holdString);
        mysql_fetch_field_row(holdString, "VIP");               characterInfo[playerid][VIP] = strval(holdString);
        mysql_fetch_field_row(holdString, "Skin");              characterInfo[playerid][Skin] = strval(holdString);
        mysql_fetch_field_row(holdString, "Raha");              characterInfo[playerid][Raha] = strval(holdString);
        mysql_fetch_field_row(holdString, "Pank");              characterInfo[playerid][Pank] = strval(holdString);
        mysql_fetch_field_row(holdString, "X");                 characterInfo[playerid][X] = strval(holdString);
        mysql_fetch_field_row(holdString, "Y");                 characterInfo[playerid][Y] = strval(holdString);
        mysql_fetch_field_row(holdString, "Z");                 characterInfo[playerid][Z] = strval(holdString);
        mysql_fetch_field_row(holdString, "Sugu");              characterInfo[playerid][Sugu] = strval(holdString);
        mysql_fetch_field_row(holdString, "Vanus");             characterInfo[playerid][Vanus] = strval(holdString);
        mysql_fetch_field_row(holdString, "KontoSeis");         characterInfo[playerid][KontoSeis] = strval(holdString);
        mysql_fetch_field_row(holdString, "streamOption");      characterInfo[playerid][streamOption] = strval(holdString);
        mysql_fetch_field_row(holdString, "Kiitus");            characterInfo[playerid][Kiitus] = strval(holdString),
        mysql_fetch_field_row(holdString, "Hoiatus");           characterInfo[playerid][Hoiatus] = strval(holdString);
        mysql_fetch_field_row(holdString, "Juhiload");          characterInfo[playerid][Juhiload] = strval(holdString);
        mysql_fetch_field_row(holdString, "Ajail");             characterInfo[playerid][Ajail] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon0");           weapon[playerid][0] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon1");           weapon[playerid][1] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon2");           weapon[playerid][2] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon3");           weapon[playerid][3] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon4");           weapon[playerid][4] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon5");           weapon[playerid][5] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon6");           weapon[playerid][6] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon7");           weapon[playerid][7] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon8");           weapon[playerid][8] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon9");           weapon[playerid][9] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon10");          weapon[playerid][10] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon11");          weapon[playerid][11] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon12");          weapon[playerid][12] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon0Ammo");       weaponAmmo[playerid][0] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon1Ammo");       weaponAmmo[playerid][1] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon2Ammo");       weaponAmmo[playerid][2] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon3Ammo");       weaponAmmo[playerid][3] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon4Ammo");       weaponAmmo[playerid][4] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon5Ammo");       weaponAmmo[playerid][5] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon6Ammo");       weaponAmmo[playerid][6] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon7Ammo");       weaponAmmo[playerid][7] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon8Ammo");       weaponAmmo[playerid][8] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon9Ammo");       weaponAmmo[playerid][9] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon10Ammo");      weaponAmmo[playerid][10] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon11Ammo");      weaponAmmo[playerid][11] = strval(holdString);
        mysql_fetch_field_row(holdString, "Weapon12Ammo");      weaponAmmo[playerid][12] = strval(holdString);
    }
   
    if(characterInfo[playerid][Hoiatus] > 2 || characterInfo[playerid][KontoSeis] == 1) {
   
        SendClientMessage(playerid, -1, "Sinu konto on banned.");
        Kick(playerid);
    }
   
    if(characterInfo[playerid][Ajail] > 0) {
   
        SendClientMessage(playerid, -1, ""COLOR_LIGHTRED"Sinu admini vangla aeg pole veel lдbi!");
        SetPlayerInterior(playerid, 18);
        SetPlayerPos(playerid, 1302.519897,-1.787510,1001.028259);
    }

    for(new i;i<13;i++) {
   
        if(weapon[playerid][i] && weaponAmmo[playerid][i]) {
       
            GivePlayerWeapon(playerid, weapon[playerid][i], weaponAmmo[playerid][i]);
        }
    }

    SendClientMessage(playerid, -1, ""COLOR_GREEN"Olete edukalt sisse logitud, head mдngimist!");
    isLogged[playerid] = true;

    SetSpawnInfo(playerid, 0, characterInfo[playerid][Skin], characterInfo[playerid][X], characterInfo[playerid][Y], characterInfo[playerid][Z], 0.0, 0, 0, 0, 0, 0, 0);
    SpawnPlayer(playerid);
    SetPlayerSkin(playerid, characterInfo[playerid][Skin]);
    SetPlayerColor(playerid, 0xFFFFFFFF);
    SetPlayerScore(playerid, 1);
    SetPlayerPos(playerid, characterInfo[playerid][X], characterInfo[playerid][Y], characterInfo[playerid][Z]);

    mysql_free_result();
    return true;
}
Reply
#4

Can You See Message of Login function ? If not there a problem in your mysql databse : check mysql debug and make sure that your database table are current
Reply
#5

Quote:
Originally Posted by Shabi RoxX
Посмотреть сообщение
Can You See Message of Login function ? If not there a problem in your mysql databse : check mysql debug and make sure that your database table are current
Tables are fine, connection with mysql database is fine, checked the logs and they are all clear and I can't see the message login function should give me.
Reply
#6

Quote:
Originally Posted by JRISETH
Посмотреть сообщение
Tables are fine, connection with mysql database is fine, checked the logs and they are all clear and I can't see the message login function should give me.
It means your one of your mysql_fetch_row is not working, currently

EDIT:I can see you made X,Y,Z an integer and I think it must be float ? However the problem is not this.
Reply
#7

Quote:
Originally Posted by Shabi RoxX
Посмотреть сообщение
Can You See Message of Login function ? If not there a problem in your mysql databse : check mysql debug and make sure that your database table are current
Quote:
Originally Posted by Shabi RoxX
Посмотреть сообщение
It means your one of your mysql_fetch_row is not working, currently

EDIT:I can see you made X,Y,Z an integer and I think it must be float ? However the problem is not this.
mysql_fetch_row can't be the problem, haven't touched anything there for a long time and everything worked before..
Yeah, I know that X,Y,Z must be actually floats not intergers, fixed this.
Reply
#8

Just removed all the mysql_fetch_field_row lines from login and still, nothing seems to be working.
Reply
#9

Bump!
Reply
#10

problably same dialogs ids.
check if you don't have other dialog with the same id
it keeps requesting password because the dialog response don't have effect with that dialog.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)