Ulysses

General => Developers Corner => Topic started by: awesomenessispure on September 24, 2014, 02:45:34 PM

Title: Make a ulx menu for !dm
Post by: awesomenessispure 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" )
Title: Re: Make a ulx menu for !dm
Post by: JamminR 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)
Title: Re: Make a ulx menu for !dm
Post by: awesomenessispure on September 24, 2014, 03:24:23 PM
Can you tell me what to fix exactly? I am a noob at ULX.
Title: Re: Make a ulx menu for !dm
Post by: JamminR 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.