SA-MP Forums Archive
Save a inputtext for later use? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Save a inputtext for later use? (/showthread.php?tid=153141)



Save a inputtext for later use? - oliverrud - 07.06.2010

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?


Re: Save a inputtext for later use? - oliverrud - 07.06.2010

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


Re: Save a inputtext for later use? - RyDeR` - 07.06.2010

format, strmid or SetPVarString you can choose.


Re: Save a inputtext for later use? - oliverrud - 07.06.2010

The code isn't in the same:

pawn Код:
{

}
So would a string work?


Re: Save a inputtext for later use? - Backwardsman97 - 07.06.2010

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



Re: Save a inputtext for later use? - MadeMan - 07.06.2010

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);
    }



Re: Save a inputtext for later use? - oliverrud - 07.06.2010

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)


Re: Save a inputtext for later use? - kingdutch - 07.06.2010

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


Re: Save a inputtext for later use? - oliverrud - 07.06.2010

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.