Author Topic: Make a ulx menu for !dm  (Read 1852 times)

0 Members and 1 Guest are viewing this topic.

Offline awesomenessispure

  • Newbie
  • *
  • Posts: 9
  • Karma: -7
Make a ulx menu for !dm
« on: September 24, 2014, 02:45:34 PM »
I have the spectator deathmatch addon in ttt. I want admins to be able to force people. I tried this code it doesn't work how can I fix it.
Code: [Select]
local CATEGORY_NAME = "Deathmatch"

function ulx.deathmatch( calling_ply, target_ply, command )
    if not target_ply:Alive() then
        v:ConCommand("say !dm")
        ulx.fancyLogAdmin( calling_ply, true, "#A Joined Deathmatch", target_ply )
    end
end

local deathmatch = ulx.command( CATEGORY_NAME, "ulx deathmatch", ulx.deathmatch, "!ulxdm", true )
deathmatch:addParam{ type=ULib.cmds.PlayerArg }
deathmatch:defaultAccess( ULib.ACCESS_ADMIN )
deathmatch:help( "Makes player join deathmatch" )

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Make a ulx menu for !dm
« Reply #1 on: September 24, 2014, 03:13:14 PM »
Code: [Select]
if not target_ply:Alive() then
        v:ConCommand("say !dm")

Look at your error in console when you try to run that.
Variable "v" is null.
You don't have it defined (hint - you need to use another variable you are already using)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline awesomenessispure

  • Newbie
  • *
  • Posts: 9
  • Karma: -7
Re: Make a ulx menu for !dm
« Reply #2 on: September 24, 2014, 03:24:23 PM »
Can you tell me what to fix exactly? I am a noob at ULX.
« Last Edit: September 24, 2014, 03:38:39 PM by awesomenessispure »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Make a ulx menu for !dm
« Reply #3 on: September 24, 2014, 03:48:23 PM »
That's 100% pure lua issue..nothing to do with ulx.
v: needs to be target_ply: because you pass variables calling_ply and target_ply to the function, but never define what v is.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming