Results 1 to 10 of 24

Thread: Bank system script

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Noof's scripts

    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;
        
    10;
        
    10;
        
    width 300;
        
    height 200;
        
    text "Bank.";
        new 
    GuiButtonCtrl("Test_Button") {
          
    profile GuiBlueButtonProfile;
          
    10;
          
    50;
          
    width 100;
          
    height 30;
          
    text "Add Dollars";
        }
        new 
    GuiButtonCtrl("Test_Button2") {
          
    profile GuiBlueButtonProfile;
          
    10;
          
    90;
          
    width 100;
          
    height 30;
          
    text "Put cash in bank";
        }
        new 
    GuiButtonCtrl("Test_Button3") {
          
    profile GuiBlueButtonProfile;
          
    10;
          
    140;
          
    width 250;
          
    height 30;
          
    text "Take cash out of bank";
        }
        new 
    GuiTextCtrl("Test_Text") {
          
    profile GuiBlueTextProfile;
          
    120;
          
    50;
          
    height 15;
          
    text "Cash: " this.money;
        }
        new 
    GuiTextCtrl("Test_Text2") {
          
    profile GuiBlueTextProfile;
          
    120;
          
    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(200temp.sxtemp.sy"Arial""(b,i,r,c)""Cash: " this.money 1);
      
    changeimgvis(2004); // it has to be over 4 for it to stick on the screen
      
    setTimeout(0.5);

    Thanks for your time!

    -Noof
    Last edited by Noofboy12; 01-07-2015 at 09:19 PM.
    Noof was here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •