I have this problem with command setweapon.
When "flashlight" is OFF, players can use their weapons.
When it's ON, only knife is allowed. ( like Doom 3 )
Here is the script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
addhook("serveraction","D3serva") function D3serva(id,sa) 	if sa == 3 then 		if flashlight == 0 then 			for i = 1,32 do 			if player(i,"exists") then 				weapon[i] = player(i,"weapontype") 				parse("setweapon "..i.." 50") 			end 			end 			flashlight = 1 			parse("trigger black") 		elseif flashlight == 1 then 			for i = 1,32 do 			if player(i,"exists") then 				parse("setweapon "..i.." "..weapon[i]) 			end 			end 			flashlight = 0 			parse("trigger black") 		end 	end end
When flashlight is turned OFF, setweapon will set their previous weapon from table weapon[id].
I think the problem is that setweapon can't read table values, but how can I avoid this?
I tried to use local value
1
2
2
local wp = weapon[i] parse("setweapon "..i.." "..wp)
Please help me when you have time.
Thanks beforehand!