SA-MP Forums Archive
My bank system [Help] - 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)
+--- Thread: My bank system [Help] (/showthread.php?tid=293403)



My bank system [Help] - LiamM - 28.10.2011

Well, I've designed a full banking system and everything works the way it should but I thought it would be a nicer interface if I used Dialogs... So I came across a problem with that..
For my Withdraw and deposit dialog. There both input boxes but how do I retrieve the inputtext and put it to a variable that I can use later on?

In other words
Making a variable called bankwithdraw

Then once I have put the inputtext to the bankwithdraw I can do
PlayerInfo[playerid][BankAmount] - bankwithdraw
So it subtracts how ever much the player typed from the money in their bank account. Thanks


Re: My bank system [Help] - LiamM - 29.10.2011

bump Anyone?


Re: My bank system [Help] - SmiT - 29.10.2011

You have to use strval:

pawn Код:
PlayerInfo[ playerid ][ BankAmount ] -= strval( inputtext );
It will substract the ammount of money the player has entered in the dialog.


Re: My bank system [Help] - Vince - 29.10.2011

And when a player types any negative number into the box, it will add it to his account (because minus-minus makes plus). Needs more checks, to say the least.


Re: My bank system [Help] - Tomejus - 29.10.2011

Quote:
Originally Posted by Vince
Посмотреть сообщение
And when a player types any negative number into the box, it will add it to his account (because minus-minus makes plus). Needs more checks, to say the least.
It only needs to check with < >.


Re: My bank system [Help] - LiamM - 29.10.2011

Oh yeah Vince, your right. I would never have thought of that! How would I do checks and things to make sure they don't use a negative? I've never had to do it before so never thought of that


Re: My bank system [Help] - SmiT - 29.10.2011

pawn Код:
if ( strval ( inputtext ) < 0 )
{
    // Do you code
}



Re: My bank system [Help] - LiamM - 29.10.2011

Oh thats simple! Thanks very much!