Author Topic: Cooldown for certain commands  (Read 3290 times)

0 Members and 1 Guest are viewing this topic.

Offline ATomIC

  • Newbie
  • *
  • Posts: 4
  • Karma: -3
Cooldown for certain commands
« on: July 24, 2014, 02:30:55 PM »
Could someone help me figure out how to add a cooldown to commands such as ULX ASAY, ULX PSAY, and provide just a snippet of code so I could figure out how to do it? I hate trolls coming into the server spamming "N*GGER" into ASAY.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Cooldown for certain commands
« Reply #1 on: July 24, 2014, 02:48:25 PM »
ULX's anti-spam stuff code are a good place to start looking -
https://github.com/Nayruden/Ulysses/blob/master/ulx/lua/ulx/modules/sh/chat.lua#L258

You could then use that idea within a "ULibCommandCalled" hook to start the timer, make sure it's passed, adn return if it's passed, return false if time hasn't passed.

And, perhaps better yet, this might be a good topic for "Suggestion" forum area.
Though we already perform chat spam checks for the Gmod PlayerSay hook, as our asay/csay/other functions that communicate with players are custom, they don't use the playersay hook.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Cooldown for certain commands
« Reply #2 on: July 24, 2014, 02:50:07 PM »
Better yet, remove the ASAY permission from "user" group.
Seems bad idea to allow users to grafitti the admin wall.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline ATomIC

  • Newbie
  • *
  • Posts: 4
  • Karma: -3
Re: Cooldown for certain commands
« Reply #3 on: July 24, 2014, 03:01:03 PM »
Better yet, remove the ASAY permission from "user" group.
Seems bad idea to allow users to grafitti the admin wall.
What if a user needs to contact an Admin?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Cooldown for certain commands
« Reply #4 on: July 24, 2014, 09:51:18 PM »
PlayerChat: Is there an admin online?

Or, if offline:
http://forums.ulyssesmod.net/index.php/topic,7391.0.html
http://forums.ulyssesmod.net/index.php/topic,7394.0.html - bit more complicated - requires your own web/php server.

"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming