Liberty Unleashed
Scripting => Script Help => Topic started by: Rocky on April 17, 2013, 11:44:05 am
-
I added a GUI Bank system where player can withdraw or Deposit by entering amount. so once player clicks Deposit button
Deposit_Button.SetCallbackFunc( "DepositMoney" );
This script shows up.
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
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.
if( !amount || !IsNum( amount ) ) otherwL.Text = "Amount should be numeric*";
Bug or my coding skills sucks?
-
You should atleast do
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 (`).
-
You should atleast do
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