decided to use the global timer idea with the "the cookie jar is empty" line.
thanks all please post improvements you might have or if you know how to add a timer for individuals that would also be great for learning purposes.
here is the finished code:
CATEGORY_NAME = "Grinny's Stuff" --Change this for the category name of choice, this will be the tab that the command is under in the !menu
-----------------------------Cookie-----------------------------
local waittime = 5 --Change this value for a differ in wait time after !cookie has been executed
local lastusecookie = -waittime
function ulx.cookie(calling_ply, target_plys, times)
if waittime + lastusecookie > CurTime() then
ULib.tsayError(calling_ply, "Sorry, the cookie jar is empty! Please wait " .. waittime .. " seconds for it to fill up")
else
ulx.fancyLogAdmin( calling_ply, "#A gave #T #i cookies!", target_plys, times )
lastusecookie = CurTime()
end
end
local cookie = ulx.command( CATEGORY_NAME, "ulx cookie", ulx.cookie, "!cookie" )
cookie:addParam{ type=ULib.cmds.PlayersArg }
cookie:addParam{ type=ULib.cmds.NumArg, min=1, default=1, hint="times", ULib.cmds.optional, ULib.cmds.round }
cookie:defaultAccess( ULib.ACCESS_ADMIN )
cookie.help( "spread the love with cookies!" )
as you can see i added a cookie counter so to speak, where users can select how many cookies to give people.
this code all works well (although for some reason any functions below it do not work? i dont know why this happens but if i put any new commands that i make below it in the same file they just dont work, however if i but the cookie command below the other command it does? if anyone knows how to fix that it would be great, its not a huge problem, i just have a seperate file for uncookie as it does the same thing so i cant have them both in the same file. )
Thanks for all your help!