Neon + MySQL
#1

I cannot login into my account ingame.
pawn Код:
if(dialogid == 1)
    {
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "You are not registered", "Type your password below", "Register"," ");
        new pname[24],ip[50],escname[24],Query[350],password[129];
        GetPlayerName(playerid, pname, sizeof(pname));
        mysql_real_escape_string(pname,escname);
        WP_Hash(password,129,inputtext);
        GetPlayerIp(playerid,ip,50);
        format(Query,300,"INSERT INTO `playerinfo` (`user`,`password`,`IP`,`kills`,`deaths`,`score`,`money`,`level`,`donor`) VALUES ('%s', '%s', '%s',0,0,0,0,0,0)",escname,password,ip);
        mysql_query(Query);
        SendClientMessage(playerid,limegreen,"You have successfully registered!");
        PInfo[playerid][Regged] = 1;
        PInfo[playerid][Logged] = 1;
    }

    else if(dialogid == 2)
    {
        new pname[24],Query[350],escname[24],password[129];
        GetPlayerName(playerid,pname,24);
        if(!response) return Kick(playerid);
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Type your password below", "Login", "Quit");
        mysql_real_escape_string(pname,escname);
        WP_Hash(password,129,inputtext);
        format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `user` = '%s' AND `password` = '%s'", escname, password);
        mysql_query(Query);
        mysql_store_result();
        if(!mysql_num_rows())
        {
            SendClientMessage(playerid,RED,"ERROR: Invalid Password!");
            SetPVarInt(playerid,"MaxFails",GetPVarInt(playerid,"MaxFails") +1);
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Type your password below", "Login", "Quit");
            if(GetPVarInt(playerid,"MaxFails") == 3)
            {
                new string[128];
                format(string,128,"%s has been kicked for failing to login",pname);
                SendClientMessageToAll(RED,string);
                Kick(playerid);
            }
            mysql_free_result();
        }
        else
        {
            new line[800];
            if(mysql_fetch_row(line)) //Fetches the line
            {
                   new data[3][100]; //The data strings
                   new data2[6]; //The data variables
                   sscanf(line, "p|sssdddddd",data[0],data[1],data[2],data2[0],data2[1],data2[2],data2[3],data2[4],data2[5]); //Splits the line with sscanf
                   PInfo[playerid][Kills] = data2[0];
                   PInfo[playerid][Deaths] = data2[1];
                   SetPlayerScore(playerid, data2[2]);
                   PInfo[playerid][Score] = data2[2];
                   PInfo[playerid][Cash] = data2[3];
                   GivePlayerMoney(playerid,data2[3]);
                   SetPVarInt(playerid,"Level",data2[4]);
                   PInfo[playerid][VIP] = data2[5];
                   new loginstring[200];
                   format(loginstring,200,"You have logged in! [Admin Level: %d] [Donor Level: %d] [Kills: %d] [Deaths: %d] [Score: %d] [Cash: %d]",GetPVarInt(playerid,"Level"),PInfo[playerid][VIP],PInfo[playerid][Kills],PInfo[playerid][Deaths],PInfo[playerid][Score],PInfo[playerid][Cash]);
                   SendClientMessage(playerid,limegreen,loginstring);
                   mysql_free_result();
            }
        }
    }
I am using Whirlpool + StrickenKid's mysql plugin.

Thanks
~Snipa
Reply


Messages In This Thread
MySQL - by Snipa - 02.06.2011, 00:22
Re: Neon + MySQL - by Steve M. - 02.06.2011, 13:01
Re: Neon + MySQL - by Snipa - 02.06.2011, 18:24
Re: Neon + MySQL - by Snipa - 03.06.2011, 11:28
Re: Neon + MySQL - by rbN. - 03.06.2011, 11:31
Re: Neon + MySQL - by Snipa - 03.06.2011, 15:18
Re: Neon + MySQL - by Snipa - 03.06.2011, 22:43
Re: Neon + MySQL - by Snipa - 04.06.2011, 12:13

Forum Jump:


Users browsing this thread: 1 Guest(s)