English Add god in the menu.

8 replies
Goto Page
To the start Previous 1 Next To the start
12.03.14 05:49:57 pm
Up
Mora_rus
User
Offline Off
Hello, someone can add God mode in this menu?
Code:
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
owner = {114940}
ons=false
parse("sv_fow 0")

addhook("serveraction","_s")
function _s(id,key)
 for _,usgn in ipairs(owner) do 
  if player(id,"usgn")==usgn then
if key==1 then
menu(id,"Menu,Fog Of War|"..getboleantype(ons).."")
  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|"..getboleantype(ons).."")
end
end
end

function getboleantype(var)
if var==false then
return "OFF"
elseif var==true then
return "ON"
end
end

this will work, like a F.O.W. when press it,I got God mode and button will "ON",off then "OFF".
thanks
S.T.A.L.K.E.R. - The Lost Land dev. https://discord.gg/aABCkHQ
12.03.14 06:20:53 pm
Up
Rainoth
Moderator
Offline Off
When you tab your code, I'll happily do it
12.03.14 07:09:13 pm
Up
Marcell
Super User
Offline Off
Spoiler >


Works like charm, because i tested it
13.03.14 12:22:24 am
Up
VADemon
User
Offline Off
Provides a code snippet that works for only one player - Proves it by testing it on his own.
user Marcell has written:
Works like charm, because i tested it


~The code is too derpy to edit. You have a typo in "getboleantype" - it's "boolean"

UPD: Working code:
Code:
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
edited 1×, last 13.03.14 10:20:47 am
13.03.14 04:50:39 am
Up
Marcell
Super User
Offline Off
Who cares lol
edited 1×, last 13.03.14 05:17:09 am
13.03.14 09:12:05 am
Up
Mora_rus
User
Offline Off
@user Marcell: this work for all, when i ON it, for bots/joined/pairs. 3 words- Work for all.
S.T.A.L.K.E.R. - The Lost Land dev. https://discord.gg/aABCkHQ
13.03.14 10:17:29 am
Up
UnkN
User
Offline Off
Spoiler >


Happy Fun
Nothing here.
13.03.14 12:17:21 pm
Up
Mora_rus
User
Offline Off
Thanks All, @user UnkN: for work script.
@user Marcell: for try help me.
@user VADemon: for try help me.
S.T.A.L.K.E.R. - The Lost Land dev. https://discord.gg/aABCkHQ
28.01.17 11:24:40 pm
Up
Danel Matto
BANNED
Offline Off
user Marcell has written:
Spoiler >


Works like charm, because i tested it

Wow Thanks help you
To the start Previous 1 Next To the start