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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
owner = {114940, 7844, 1, 42}
ons=false
parse("sv_fow 0")
godMode={}
addhook("hit","_hit")
function _hit(id)
if godMode[id] then
return 1
end
end
addhook("leave","godmode_reset")
function godmode_reset(id)
	godMode[id] = nil
end
addhook("serveraction","_s")
function _s(id,key)
for _,usgn in ipairs(owner) do
		msg("Checking usgn ".. usgn)
		if player(id,"usgn")==usgn then
			if key==1 then
				menu(id,"Menu,Fog Of War|"..getbooleantype(ons)..",GOD Mode|" ..boolToStr( godMode[id]).. "")
			end
end
end
end
addhook("menu","_m")
function _m(id,title,b)
	if title=="Menu" then
		if b == 1 then
			if ons==true then
				ons=false
				parse("sv_fow 0")
			else
				ons=true
				parse("sv_fow 1")
			end
			menu(id,"Menu,Fog Of War|"..getbooleantype(ons)..",GOD Mode|" ..boolToStr( godMode[id]).. "")
		elseif b == 2 then
			godMode[ id ] = not godMode[ id ] -- toggle god mode state
			godModeMessage(id)
			menu(id,"Menu,Fog Of War|"..getbooleantype(ons)..",GOD Mode|" ..boolToStr( godMode[id]).. "")
		end
	end
end
function godModeMessage(id)
	msg2(id, "©000255125God mode was ".. (godMode[id] and "en" or "dis") .. "abled for you!")
end
function getbooleantype(var)
if var==false then
return "OFF"
elseif var==true then
return "ON"
end
end
-- booleanToString
-- this not only checks against TRUE|FALSE but also for NIL
-- 		existing elements (tables, numbers etc.) count as TRUE ("ON") while not existing ones like NIL return "OFF"
function boolToStr( val )
if val then
		return "ON"
	end
	return "OFF"	
end