So I'm making a custom round events script for my server. I finished the round events and now I would like to add a custom ULX command. I have created a ULX command before using premade commands on Maurits.tv but never have I made a CUSTOM ULX command. How would I create this command to set the round in motion?
[CODE]function ulx.roundevent(calling_ply,target_ply,event)
target_ply.SetFrags frags)
end
local roundevent = ulx.command("event","ulx event", ulx.event,"!event",true)
setfrags:addParam{ type=ULib.cmds.PlayerArg }
setfrags:defaultAcess( ULib.ACCESS_ADMIN )
setfrags:help("Sets the round for the Game.")
ulx.fancyLogAdmin( calling_ply,true,"#A set the round to ..Math.random.", target_ply, event)
[/CODE]
I know the target_ply says SetFrags. I got stuck there. There's going to be a lot of issues with this command I bet.
I'm using the function roundstart () for this BTW
What you can do is use a convar.
[lua]local CATEGORY_NAME = "Fun"
function ulx.event(ply, event, evalue, etime)
if GetConVarNumber("tttlvl.2x.xp") == 1 then
RunConsoleCommand("tttlvl.2x.xp", 0)
RunConsoleCommand("tttlvl.2x.time", 0)
elseif GetConVarNumber("tttlvl.2x.pt") == 1 then
RunConsoleCommand("tttlvl.2x.pt", 0)
RunConsoleCommand("tttlvl.2x.time", 0)
elseif GetConVarNumber("tttlvl.2x.both") == 1 then
RunConsoleCommand("tttlvl.2x.both", 0)
RunConsoleCommand("tttlvl.2x.time", 0)
end
RunConsoleCommand(event, evalue)
RunConsoleCommand("tttlvl.2x.time", etime)
timer.Create("tttlvltimer", etime, 0, tttlvleventstop)
end
local tttevent = ulx.command(CATEGORY_NAME, "ulx event", ulx.event, "!event", true)
tttevent:addParam{ type = ULib.cmds.StringArg }
tttevent:addParam{ type = ULib.cmds.NumArg }
tttevent:addParam{ type = ULib.cmds.NumArg }
tttevent:defaultAccess(ULib.ACCESS_ADMIN)
tttevent:help("Type what event, second number: 1 = true, 0 = false and choose how long for the TTT Levelling System.\n\n Available Paremeters: \n\n tttlvl.2x.xp \n\n tttlvl.2x.pt \n\n tttlvl.2x.both")[/lua]
This is something I did for a TTT Levelling system, basically all the if checks are to get rid of the old one.
Anyway, if you use a convar, it also carries map-change.
[QUOTE=Nookyava;43843185]What you can do is use a convar.
[lua]local CATEGORY_NAME = "Fun"
function ulx.event(ply, event, evalue, etime)
if GetConVarNumber("tttlvl.2x.xp") == 1 then
RunConsoleCommand("tttlvl.2x.xp", 0)
RunConsoleCommand("tttlvl.2x.time", 0)
elseif GetConVarNumber("tttlvl.2x.pt") == 1 then
RunConsoleCommand("tttlvl.2x.pt", 0)
RunConsoleCommand("tttlvl.2x.time", 0)
elseif GetConVarNumber("tttlvl.2x.both") == 1 then
RunConsoleCommand("tttlvl.2x.both", 0)
RunConsoleCommand("tttlvl.2x.time", 0)
end
RunConsoleCommand(event, evalue)
RunConsoleCommand("tttlvl.2x.time", etime)
timer.Create("tttlvltimer", etime, 0, tttlvleventstop)
end
local tttevent = ulx.command(CATEGORY_NAME, "ulx event", ulx.event, "!event", true)
tttevent:addParam{ type = ULib.cmds.StringArg }
tttevent:addParam{ type = ULib.cmds.NumArg }
tttevent:addParam{ type = ULib.cmds.NumArg }
tttevent:defaultAccess(ULib.ACCESS_ADMIN)
tttevent:help("Type what event, second number: 1 = true, 0 = false and choose how long for the TTT Levelling System.\n\n Available Paremeters: \n\n tttlvl.2x.xp \n\n tttlvl.2x.pt \n\n tttlvl.2x.both")[/lua]
This is something I did for a TTT Levelling system, basically all the if checks are to get rid of the old one.
Anyway, if you use a convar, it also carries map-change.[/QUOTE]
Thanks alot :)
Sorry, you need to Log In to post a reply to this thread.