MYSQL help please.
#1

Hey, so I started messing around with MYSQL hoping that I could learn more about it. I went through a few tutorials but I end up with one problem.
pawn Код:
//So the problem is everytime I try to log in, I enter the correct password the player won't log.
//When I enter my password the dialog dissappears and nothing happens, after a while I crash.
//Registering and all other stuff are working great but I just end up with this, any help is appreciated

    if(dialogid == DIALOG_LOGIN)
    {
    if(!response) return Kick (playerid);
    if(response)
    {
        new query[256], EncryptedPass[130];
        WP_Hash(EncryptedPass, sizeof(EncryptedPass), inputtext);
        format(query, sizeof(query), "SELECT * FROM accounts WHERE name = '%s' AND password = '%s'", GPN(playerid), EncryptedPass);
        mysql_query(query);
        mysql_store_result();
        if(mysql_num_rows() != 0)
        {
            LoadPlayer(playerid);
        }
        else
        {
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{FF8000}Login","{FFFFFF}Wrong password.\nLogin below with the password you registered with.","Login","Quit");
        }
    }
    }

//LoadPlayer
stock LoadPlayer(playerid)
{
    new query[128];
    format(query, sizeof(query), "SELECT * FROM accounts WHERE Name = '%s'", GPN(playerid));
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row_format(query,"|"))
    {
        mysql_fetch_field_row(query, "ID"); PlayerInfo[playerid][pID] = strval(query);
        mysql_fetch_field_row(PlayerInfo[playerid][pName], "Name");
        mysql_fetch_field_row(PlayerInfo[playerid][pPass], "Password");
    }
    SendClientMessage(playerid,COLOR_WHITE,"WB");
    SetSpawnInfo(playerid,0,0,0,0,0,0,0,0,0,0,0,0);
    SpawnPlayer(playerid);
    TogglePlayerSpectating(playerid, 0);
    SetCameraBehindPlayer(playerid);
    //SetPlayerPos(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
    if(PlayerInfo[playerid][pVModel] > 0)
    {
    PlayerInfo[playerid][pVehicle] = CreateVehicle(PlayerInfo[playerid][pVModel],PlayerInfo[playerid][pVX],PlayerInfo[playerid][pVY],PlayerInfo[playerid][pVZ],PlayerInfo[playerid][pVA],PlayerInfo[playerid][pVColor1],PlayerInfo[playerid][pVColor2],-1);
    Fuel[PlayerInfo[playerid][pVehicle]] = PlayerInfo[playerid][pVFuel];
    for(new i = 0; i < MAX_MODS; i++)
    {
    AddVehicleComponent(PlayerInfo[playerid][pVehicle], PlayerInfo[playerid][pVMods][i]);
    }
    }
    return 1;
}
Reply


Messages In This Thread
MYSQL help please. - by TonyII - 21.09.2014, 19:51
Re: MYSQL help please. - by MrCallum - 21.09.2014, 20:02
Re: MYSQL help please. - by iSkate - 21.09.2014, 20:08
Re: MYSQL help please. - by Vince - 21.09.2014, 20:21
Re: MYSQL help please. - by TonyII - 21.09.2014, 20:42
Re: MYSQL help please. - by TonyII - 22.09.2014, 16:38
Re: MYSQL help please. - by Eth - 22.09.2014, 16:41
Re: MYSQL help please. - by TonyII - 22.09.2014, 17:06
Re: MYSQL help please. - by Eth - 22.09.2014, 17:18
Re: MYSQL help please. - by TonyII - 22.09.2014, 21:35

Forum Jump:


Users browsing this thread: 8 Guest(s)