Save a inputtext for later use?
#1

My problem is:
I've been trying to save a inputtext of a password for a later mysql query.

pawn Код:
if(dialogid == 600 && response)
    {
      format(stringsize, sizeof(stringsize), "SELECT * FROM "SQL_BANK" WHERE Password = '%s' LIMIT 1",inputtext);
      mysql_query(stringsize, -1, -1, RegistrationSystemConnection);
      mysql_store_result(RegistrationSystemConnection);
      if(mysql_num_rows(RegistrationSystemConnection) > 0)
        {
          format(banksave,128,"%s",inputtext);
            BankData[playerid][bLogged] = true;
            SendClientMessage(playerid,COLOR_YELLOW,"You have logged into a bank account");
            SetPVarString(playerid,"BankSavePass",banksave);
        }
    }
That's the inputtext I have to save for this part of the script:
pawn Код:
{
      new string2[128];
        format(string,128,"UPDATE `bank` SET `Amount`='%s' WHERE `Password`='%s'",inputtext,GetPVarString(playerid,"BankSavePass",banksave,300));
        mysql_query(string);
        format(string2,128,"You deposited %s$ into the logged in bank account",inputtext);
        SendClientMessage(playerid,COLOR_YELLOW,string2);
    }
Is there another way to store a string then SetPVarString and GetPVarString?
Reply
#2

Anybody who got an solution? Been struggling for the last 2 days with this problem
Reply
#3

format, strmid or SetPVarString you can choose.
Reply
#4

The code isn't in the same:

pawn Код:
{

}
So would a string work?
Reply
#5

pawn Код:
SetPVarString(playerid,"InputText",inputtext);
Reply
#6

pawn Код:
{
        new string2[128];
        GetPVarString(playerid,"BankSavePass",banksave,sizeof(banksave));
        format(string,128,"UPDATE `bank` SET `Amount`='%s' WHERE `Password`='%s'",inputtext,banksave);
        mysql_query(string);
        format(string2,128,"You deposited %s$ into the logged in bank account",inputtext);
        SendClientMessage(playerid,COLOR_YELLOW,string2);
    }
Reply
#7

Quote:
Originally Posted by MadeMan
pawn Код:
{
        new string2[128];
        GetPVarString(playerid,"BankSavePass",banksave,sizeof(banksave));
        format(string,128,"UPDATE `bank` SET `Amount`='%s' WHERE `Password`='%s'",inputtext,banksave);
        mysql_query(string);
        format(string2,128,"You deposited %s$ into the logged in bank account",inputtext);
        SendClientMessage(playerid,COLOR_YELLOW,string2);
    }
It's not how I want it, heres how the system should go: You first get a login screen where you login with your pass(then I want the pass saved for a later mysql query for that player)
Reply
#8

It's actually exactly as you want it.

You want to SetPVarString(playerid, "BankSavePass", password); (If that's correct syntax :$) when the player logs in
And GetPVarString(playerid, "BankSavePass", banksave, sizeof(banksave)); when you update your bank.

Just a side note: Why do you use the bankpass to identify the user (Where password='') this would mean that if I as a player can change my password into another player's password, I can get into their bank account without accessing their ig account
Reply
#9

Quote:
Originally Posted by kingdutch
It's actually exactly as you want it.

You want to SetPVarString(playerid, "BankSavePass", password); (If that's correct syntax :$) when the player logs in
And GetPVarString(playerid, "BankSavePass", banksave, sizeof(banksave)); when you update your bank.

Just a side note: Why do you use the bankpass to identify the user (Where password='') this would mean that if I as a player can change my password into another player's password, I can get into their bank account without accessing their ig account
That's exactly the plan and btw it's the bank pass not the users, and no you can't change pass as theres no choice for that. However, It wont work with that SetPVarString and stuff it just outputs stuff like wierd letters and stuff.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)