Forum
CS2D Scripts Function cooldown timeFunction cooldown time
15 Antworten 1
2. When player uses spell, set cooldown variable to whatever the cooldown time you want.
3. Decrease this variable by 1 each second in second hook.
4. When cooldown is 0, make players be able to use that spell again.
It's incredibly simple. I didn't give you the code because I need to see your code in order to properly make it.
If you want me (or someone else) to write the code for cooldown, then post your code here.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--RAIN OF FIRE-- addhook ("say","hellfire") function hellfire (id,text) x=player(id,"x") y=player(id,"y") x1=128 y1=128 x2=256 y2=256 function expl1(id) 	parse ("explosion "..(x+x1).." "..y.." 125 75 "..id) 	parse ("explosion "..x.." "..(y+y1).." 125 75 "..id) 	parse ("explosion "..(x+70).." "..(y+70).." 125 75 "..id) 	parse ("explosion "..(x-x1).." "..y.." 125 75 "..id) 	parse ("explosion "..x.." "..(y-y1).." 125 75 "..id) 	parse ("explosion "..(x-70).." "..(y-70).." 125 75 "..id) 	parse ("explosion "..(x-70).." "..(y+70).." 125 75 "..id) 	parse ("explosion "..(x+70).." "..(y-70).." 125 75 "..id) end function expl2(id) 	parse ("explosion "..(x+x2).." "..y.." 125 75 "..id) 	parse ("explosion "..x.." "..(y+y2).." 125 75 "..id) 	parse ("explosion "..(x+140).." "..(y+140).." 125 75 "..id) 	parse ("explosion "..(x-x2).." "..y.." 125 75 "..id) 	parse ("explosion "..x.." "..(y-y2).." 125 75 "..id) 	parse ("explosion "..(x-140).." "..(y-140).." 125 75 "..id) 	parse ("explosion "..(x-140).." "..(y+140).." 125 75 "..id) 	parse ("explosion "..(x+140).." "..(y-140).." 125 75 "..id)	 end 	if (sample.classes.class[id]==8) then 		if (text=="!spell1") then 			if (player(id,"money")==16000) then 			 	parse ("setmoney "..id.." -16000") 				expl1(id) 				timer (500,"expl2" ,id) 			else 				msg2 (id, "You do not have enough mana!") 			end 		end 	end end
PM me your full code and I will help you.
Edit: I noticed that you already posted the important part. Give me some time.
Edit²:
1× editiert, zuletzt 30.08.14 23:44:53
Zitat
LUA ERROR: sys/lua/core/default.lua:281: bad argument #1 to 'msg2' (number expected, got no value)
En-Kay hat geschrieben
Yes it works now but can just tell me where should I add msg2(id, "Spell is ready") when cooldown is over?
There where you're decreasing the cooldown variable.
edit:
Ok I got it.
1× editiert, zuletzt 31.08.14 13:04:12
This
or
This
or
This
1