• ConCommand not working
    2 replies, posted
[lua] local function DepositBankAmt( ply, cmd, args ) local _T = args or {} local _S = string.Implode( " ", _T ) if not args or args == "" then return end if not tonumber( args ) then return end ply:AddMoney( -tonumber( _S ) ) ply:SetNWInt( "colz_bank_balance", ply:GetNWInt( "colz_bank_balance" ) + tonumber( _S ) ) end concommand.Add( "colz_deposit", DepositBankAmt ) [/lua] Works fine in console, no errors. The only problem is it doesn't do what it's suppose to: Remove the money, add the args to the players bank balance. [editline]07:22AM[/editline] Nevermind, Fixed it myself. Apparently it always returned false in my tonumber( args ) check.
[QUOTE=Helix Alioth;20185628]Apparently it always returned false in my tonumber( args ) check.[/QUOTE] That's because [i]args[/i] is a [b]table[/b] containing the arguments.
[QUOTE=Overv;20187394]That's because [i]args[/i] is a [b]table[/b] containing the arguments.[/QUOTE] Yep you should use args[1] for the first argument, args[2] for the second and so on.
Sorry, you need to Log In to post a reply to this thread.