ULX

Author Topic: Help with RunConsoleCommand  (Read 4177 times)

0 Members and 1 Guest are viewing this topic.

Offline rejax

  • Newbie
  • *
  • Posts: 5
  • Karma: 1
Help with RunConsoleCommand
« 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

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Help with RunConsoleCommand
« Reply #1 on: May 26, 2013, 11:01:10 AM »
What is line 97 in your fun.lua file?

Offline rejax

  • Newbie
  • *
  • Posts: 5
  • Karma: 1
Re: Help with RunConsoleCommand
« Reply #2 on: May 26, 2013, 11:22:07 PM »
Code: [Select]
if pl:Alive() then RunConsoleCommand( "ulx ban", pname, 0 )

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Help with RunConsoleCommand
« Reply #3 on: May 27, 2013, 12:10:13 AM »
Code: [Select]
if pl:Alive() then RunConsoleCommand( "ulx ban", pname, 0 ) end

you forgot an 'end'