Author Topic: Help Adding !warn command  (Read 3123 times)

0 Members and 1 Guest are viewing this topic.

Offline AustinFox123

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Help Adding !warn command
« 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" )

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Help Adding !warn command
« Reply #1 on: January 29, 2014, 07:02:10 PM »
Where did you put this code?
Out of the Garry's Mod business.

Offline AustinFox123

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Help Adding !warn command
« Reply #2 on: January 29, 2014, 07:29:46 PM »
addons/ulx/lua/ulx/modules/sh/warn.lua

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Help Adding !warn command
« Reply #3 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.

Offline AustinFox123

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Help Adding !warn command
« Reply #4 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

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Help Adding !warn command
« Reply #5 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

Offline AustinFox123

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Help Adding !warn command
« Reply #6 on: January 30, 2014, 03:55:12 AM »
Thanks, just what i was looking for.  ;D