General > Developers Corner

Make a ulx menu for !dm

(1/1)

awesomenessispure:
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: --- 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" )
--- End code ---

JamminR:

--- Code: --- if not target_ply:Alive() then
        v:ConCommand("say !dm")
--- End code ---

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)

awesomenessispure:
Can you tell me what to fix exactly? I am a noob at ULX.

JamminR:
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.

Navigation

[0] Message Index

Go to full version