Author Topic: Why doesn't this work?  (Read 1212 times)

Rocky

  • Full Member
  • ***
  • Posts: 105
  • Karma: +5/-3
    • View Profile
Why doesn't this work?
« on: April 17, 2013, 12:44:05 pm »
I added a GUI Bank system where player can withdraw or Deposit by entering amount. so once player clicks Deposit button

Code: [Select]
Deposit_Button.SetCallbackFunc( "DepositMoney" );
This script shows up.

Code: [Select]
function DepositMoney( )
{
    local amount = Amount_Box.Text;
    if( !amount || !IsNum( amount ) ) otherwL.Text = "Amount should be numeric*";
    else if( localPlayer.Cash < amount ) otherwL.Text = "You do not have the entered amount*";
    else
    {
        CallServerFunc( "RPG/File.nut", "DepositScript", localPlayer, amount );
        Disable_Bank_Window( );
        }
}

This line doesn't work
Code: [Select]
else if( localPlayer.Cash < amount ) otherwL.Text = "You do not have the entered amount*";
Also when i try to message/print  amount (Amount_Box.Text) my game crashes. but this line works fine.
Code: [Select]
if( !amount || !IsNum( amount ) ) otherwL.Text = "Amount should be numeric*";
Bug or my coding skills sucks?
Look for lu server testers, Requirements are:
English good enough to communicate.
Good knowledge about gaming.

PM me those who are interested.

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: Why doesn't this work?
« Reply #1 on: April 17, 2013, 04:28:48 pm »
You should atleast do
Code: [Select]
else if( localPlayer.Cash < amount.tointeger() ) otherwL.Text = "You do not have the entered amount*";

Other then that I can't really see any error.
Try putting a try and catch around it, and print the errors to the client's console (`).

Rocky

  • Full Member
  • ***
  • Posts: 105
  • Karma: +5/-3
    • View Profile
Re: Why doesn't this work?
« Reply #2 on: April 17, 2013, 04:36:30 pm »
You should atleast do
Code: [Select]
else if( localPlayer.Cash < amount.tointeger() ) otherwL.Text = "You do not have the entered amount*";

Other then that I can't really see any error.
Try putting a try and catch around it, and print the errors to the client's console (`).

thanks i always forget to put such things :P
Look for lu server testers, Requirements are:
English good enough to communicate.
Good knowledge about gaming.

PM me those who are interested.

 

© Liberty Unleashed Team.