Ulysses

General => Developers Corner => Topic started by: AustinFox123 on January 29, 2014, 05:20:39 PM

Title: Help Adding !warn command
Post by: AustinFox123 on January 29, 2014, 05:20:39 PM
So I have this code for !warn but i can't seem to get it working! No errors are being created but the code doesn't work! Please help!

local CATEGORY_NAME = "Custom"
my_warn_reasons = { "Spamming", "Rude", "Language", "Arguing with Staff", "Prop Killing" }
function ulx.warn( calling_ply, target_plys, Reason )
return true
end

local warn = ulx.command( CATEGORY_NAME, "ulx warn", ulx.warn, "!warn" )
warn:addParam{ type=ULib.cmds.PlayerArg }
warn:addParam{ type=ULib.cmds.StringArg, hint="reason", completes=my_warn_reasons, ULib.cmds.takeRestOfLine }
warn:defaultAccess( ULib.ACCESS_ADMIN )
warn:help( "Warn a player." )
warn:logString( "#1s warned #2s for #3s" )
Title: Re: Help Adding !warn command
Post by: Neku on January 29, 2014, 07:02:10 PM
Where did you put this code?
Title: Re: Help Adding !warn command
Post by: AustinFox123 on January 29, 2014, 07:29:46 PM
addons/ulx/lua/ulx/modules/sh/warn.lua
Title: Re: Help Adding !warn command
Post by: MrPresident on January 29, 2014, 07:37:28 PM
Better question.. what do you expect this to do?
The only thing this command is doing is returning true, which doesn't DO anything.
Title: Re: Help Adding !warn command
Post by: AustinFox123 on January 29, 2014, 08:22:42 PM
Well, i want the command to add a "strike" to a user so basically when they get 3 strikes (warns) then get kicked.

So the command would be like !warn David Propkill
and then it would say something like David Has 1 Warning For Reason: Propkill
Title: Re: Help Adding !warn command
Post by: MrPresident on January 29, 2014, 08:41:44 PM
Check out my Warning module. It does exactly that.
http://forums.ulyssesmod.net/index.php/topic,5958.0.html (http://forums.ulyssesmod.net/index.php/topic,5958.0.html)
Title: Re: Help Adding !warn command
Post by: AustinFox123 on January 30, 2014, 03:55:12 AM
Thanks, just what i was looking for.  ;D