General > Developers Corner

Cooldown for certain commands

(1/1)

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

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

JamminR:
Better yet, remove the ASAY permission from "user" group.
Seems bad idea to allow users to grafitti the admin wall.

ATomIC:

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

--- End quote ---
What if a user needs to contact an Admin?

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

Navigation

[0] Message Index

Go to full version