Hi I recently made a script that shows your cash with a showText() and a GUI with commands and buttons to subtract and add your dollars to your wallet and bank. Check it out below.
PHP Code:
/*This is a bank and cash system made with GS2
This was created on the TestBed server and made by Noof.
Graal Id : Graal1138884
How to use it?
You log on and you start with 0 cash and 0 in the bank, if you
click add cash you will be given 1 dollar and you can deposit that in your bank
as well withdraw.
Thank you
Note: This is on clientside so only you will be able to see "your own" cash and bank GUI.
*/
//#CLIENTSIDE
//Here is the logic and addition/subtraction happens
function Test_Button.onAction() {
with(findimg(200)) {
this.money += 1;
text = "Cash: " @ this.money;
Test_Text.text = "Cash: " @ this.money;
}
}
function Test_Button2.onAction() {
with(findimg(200)) {
if (this.money > 0) {
this.money -= 1;
text = "Cash: " @ this.money;
Test_Text.text = "Cash: " @ this.money;
this.bank += 1;
Test_Text2.text = "Bank: " @ this.bank;
}
}
if (this.money = 0) {
return false;
} else {
return true;
}
}
function Test_Button3.onAction() {
with(findimg(200)) {
this.money = this.money + this.bank;
text = "Cash: " @ this.money;
Test_Text.text = "Cash: " @ this.money;
this.bank -= this.bank;
Test_Text2.text = "Bank: " @ this.bank;
}
}
function onCreated() {
with(findimg(200)) {
this.money += 1;
text = "Cash: " @ this.money;
Test_Text.text = "Cash: " @ this.money;
}
Test_Window.destroy();
new GuiWindowCtrl("Test_Window") {
profile = GuiBlueWindowProfile;
canmove = false;
canresize = false;
closequery = false;
transparent = false;
x = 10;
y = 10;
width = 300;
height = 200;
text = "Bank.";
new GuiButtonCtrl("Test_Button") {
profile = GuiBlueButtonProfile;
x = 10;
y = 50;
width = 100;
height = 30;
text = "Add Dollars";
}
new GuiButtonCtrl("Test_Button2") {
profile = GuiBlueButtonProfile;
x = 10;
y = 90;
width = 100;
height = 30;
text = "Put cash in bank";
}
new GuiButtonCtrl("Test_Button3") {
profile = GuiBlueButtonProfile;
x = 10;
y = 140;
width = 250;
height = 30;
text = "Take cash out of bank";
}
new GuiTextCtrl("Test_Text") {
profile = GuiBlueTextProfile;
x = 120;
y = 50;
height = 15;
text = "Cash: " @ this.money;
}
new GuiTextCtrl("Test_Text2") {
profile = GuiBlueTextProfile;
x = 120;
y = 90;
height = 20;
text = "Bank: " @ this.bank;
}
}
onSolve();
}
function onSolve() {
temp.sx = .95 * screenwidth;
temp.sy = .95 * screenheight;
//start doing stuff
this.bank = 1;
this.money; //declaring the players intital money!
showtext(200, temp.sx, temp.sy, "Arial", "(b,i,r,c)", "Cash: " @ this.money + 1);
changeimgvis(200, 4); // it has to be over 4 for it to stick on the screen
setTimeout(0.5);
}
Thanks for your time!
-Noof