General > Developers Corner

Help with RunConsoleCommand

(1/1)

rejax:

--- Code: ---function GetPlayerName(ply)
return trace.Entity:Nick()
end

GetPlayerName(ply)
local pname = GetPlayerName(ply)

--spawntrain stuff

timer.Create( "bantrain", .3, 1, function( target_plys )
if pl:Alive() then RunConsoleCommand( "ulx ban", pname, 0 )
end )
end

--- End code ---

Hi so I'm not too great at lua and I'm trying to make a command which spawns a train which permabans them on impact. However, I just can't get the ban bit right. I want to use ulx ban so that it can be reversed easily if need be. Basically this code just kills them, (I'm working on bots and myself) and it also tosses out an error whenever i save it.


--- Code: ---[ERROR] addons/ulx/lua/ulx/modules/sh/fun.lua:97: unexpected symbol near ')'
  1. unknown - addons/ulx/lua/ulx/modules/sh/fun.lua:0

--- End code ---

Any pointers would be top!  ;D

MrPresident:
What is line 97 in your fun.lua file?

rejax:

--- Code: ---if pl:Alive() then RunConsoleCommand( "ulx ban", pname, 0 )

--- End code ---

MrPresident:

--- Code: ---if pl:Alive() then RunConsoleCommand( "ulx ban", pname, 0 ) end
--- End code ---


you forgot an 'end'

Navigation

[0] Message Index

Go to full version