Ulysses

General => Developers Corner => Topic started by: rejax on May 26, 2013, 04:01:37 AM

Title: Help with RunConsoleCommand
Post by: rejax on May 26, 2013, 04:01:37 AM
Code: [Select]
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

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: [Select]
[ERROR] addons/ulx/lua/ulx/modules/sh/fun.lua:97: unexpected symbol near ')'
  1. unknown - addons/ulx/lua/ulx/modules/sh/fun.lua:0

Any pointers would be top!  ;D
Title: Re: Help with RunConsoleCommand
Post by: MrPresident on May 26, 2013, 11:01:10 AM
What is line 97 in your fun.lua file?
Title: Re: Help with RunConsoleCommand
Post by: rejax on May 26, 2013, 11:22:07 PM
Code: [Select]
if pl:Alive() then RunConsoleCommand( "ulx ban", pname, 0 )
Title: Re: Help with RunConsoleCommand
Post by: MrPresident on May 27, 2013, 12:10:13 AM
Code: [Select]
if pl:Alive() then RunConsoleCommand( "ulx ban", pname, 0 ) end

you forgot an 'end'