English Cooldown on "Use" Hook

3 replies
Goto Page
To the start Previous 1 Next To the start
20.09.17 06:27:37 pm
Up
Rhaast
User
Offline Off
How can I add a cooldown on the use hook
so players can't spam their use button
IMG:https://media1.giphy.com/media/dmLw2NEZ24nIs/100.gif
20.09.17 06:36:28 pm
Up
Masea
Super User
Offline Off
There's nothing you can do about defusing, making hostages follow you and anything else that is about the actual game. Sadly.
Create and design your GUI easy and fast: file cs2d GUI Framework (v2) (12) | Go deep of the darkness and try your intrepidity: file cs2d Outlast 2 Modification (25)
20.09.17 07:20:01 pm
Up
ajm-sh
User
Offline Off
@user Masea: Since he said "use hook" it apparently means not the actual game but the modded one.
Also i think there's a return 1 thingy for defusing hook.. so?

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
cooldown={}

addhook("use","_use")
function _use(id)
if cooldown[id]==0 then
bla bla bla
cooldown[id]=10  --in seconds



addhook("seconds","_s")
function _s()
for id=1,32 do
if cooldown[id]>0 then
cooldown[id]=cooldown[id]-1
bla bla bla
20.09.17 08:22:03 pm
Up
Masea
Super User
Offline Off
@user ajm-sh: The thread itself is kinda confusing. But you're right about "defuse" hook.
Create and design your GUI easy and fast: file cs2d GUI Framework (v2) (12) | Go deep of the darkness and try your intrepidity: file cs2d Outlast 2 Modification (25)
To the start Previous 1 Next To the start