Now I their is the amount which is "26000"
and i want the amount to be defined by the command for example:
test 26000
or
test 12000
[CODE]
local success = print
success("test")
function ftest( player, command, arguments )
RunConsoleCommand("bank_withdraw", "26000");
RunConsoleCommand("bank_deposit", "26000")
end
concommand.Add( "test", ftest )
[/CODE]
[LUA]function ftest( ply, cmd, args )
if args[1] == nil then return end
ply:ConCommand( "bank_withdraw " .. tostring( args[1] ) )
ply:ConCommand( "bank_deposit " .. tostring( args[1] ) )
end
concommand.Add( "test", ftest )[/LUA]
test 205295
test 696969
Or any number will work and convert it to a string!
More advanced method
[LUA]function ftest( ply, cmd, args )
if args[1] == nil then return end
if args[2] == nil then return end
if args[1] == "withdraw" then
ply:ConCommand( "bank_withdraw " .. tostring( args[2] ) )
elseif args[1] == "deposit" then
ply:ConCommand( "bank_deposit " .. tostring( args[2] ) )
end
end
concommand.Add( "test", ftest )[/LUA]
test "withdraw" 205295
test "deposit" 500
Wiki is overcomplicated at explaining things but here you go
[url]http://wiki.garrysmod.com/page/concommand/Add[/url]
[QUOTE=Nyaaaa;44953330][LUA]function ftest( ply, cmd, args )
if args[1] == nil then return end
ply:ConCommand( "bank_withdraw " .. tostring( args[1] ) )
ply:ConCommand( "bank_deposit " .. tostring( args[1] ) )
end
concommand.Add( "test", ftest )[/LUA]
test 205295
test 696969
Or any number will work and convert it to a string!
More advanced method
[LUA]function ftest( ply, cmd, args )
if args[1] == nil then return end
if args[2] == nil then return end
if args[1] == "withdraw" then
ply:ConCommand( "bank_withdraw " .. tostring( args[2] ) )
elseif args[1] == "deposit" then
ply:ConCommand( "bank_deposit " .. tostring( args[2] ) )
end
end
concommand.Add( "test", ftest )[/LUA]
test "withdraw" 205295
test "deposit" 500
Wiki is overcomplicated at explaining things but here you go
[url]http://wiki.garrysmod.com/page/concommand/Add[/url][/QUOTE]
thanks
[QUOTE=netanelbb;44953522]thanks[/QUOTE]
Your welcome.
Sorry, you need to Log In to post a reply to this thread.