English [Finnaly Solved] God on own server?

15 replies
Goto Page
To the start Previous 1 Next To the start
Up
VegBerg
User
Offline Off
•This problem IS solved, you can read the thread anyway for experience

Is it possible to have a "godmode" on your own server?

I have a construction server where I will try to make it so it's not too many turrets on one team...
edited 3×, last 22.07.10 02:54:29 pm
22.07.10 01:28:19 am
Up
Yorty
User
Offline Off
Make a lua script.
Quote:
"Give a small boy a hammer, and he will find that everything he encounters needs pounding."
22.07.10 01:30:45 am
Up
VegBerg
User
Offline Off
Yorty has written:
Make a lua script.

One problem, I can't lua
22.07.10 02:29:59 am
Up
Yorty
User
Offline Off
Go ask in the lua help thread. And a godmode script is easy.
Quote:
"Give a small boy a hammer, and he will find that everything he encounters needs pounding."
22.07.10 03:40:35 am
Up
VegBerg
User
Offline Off
Yorty has written:
Go ask in the lua help thread. And a godmode script is easy.

I tried to make one my self first:

Code:
1
2
3
4
5
6
7
8
adhook("hit", "health")
function health(player, player, weapon, >0, >0)
     if player(id,"usgn") == 62805 then
          return 1
     else
          return 0
     end
end
22.07.10 03:52:07 am
Up
Flacko
User
Offline Off
Code:
1
2
3
4
addhook("hit", "health")
function health(id, src)
     if player(id,"usgn") == 62805 then return 1 else return 0 end
end
22.07.10 03:55:38 am
Up
Focus2D
User
Offline Off
You want godmode, so you can go around and kill everyone else. Because you don't have the skills required, to play fair.
22.07.10 04:00:58 am
Up
VegBerg
User
Offline Off
Focus2D has written:
You want godmode, so you can go around and kill everyone else. Because you don't have the skills required, to play fair.

No, because they're not following the rules. In con_* they are not allowed to build turrets or gate fields in the enemy base... Many people give shitt in the rules so I'm removing turrets

I found an alternative way to do it too:
bind "k" "sethealth "ID" 100"

edit: Thank you, Flacko.
22.07.10 05:04:40 am
Up
Focus2D
User
Offline Off
VegBerg has written:
I found an alternative way to do it too:
bind "k" "sethealth "ID" 100"



That's not god mode, 1 awp shot and your down. Unless you edit the awp's damage.

A better option would be:
Code:
1
bind "k" "setmaxhealthhealth "ID" 250"
22.07.10 12:03:53 pm
Up
VegBerg
User
Offline Off
I tried to make it more advanced but get an error at line 4

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
addhook("say","god")
function god(player, text)
   if msg("!godmode 1") then
          if player(id,"usgn") == 62805 then
               return 1
               adhook("hit", "health")
               function health(id, src)
                    if player(id,"usgn") == 62805 then return 1 else return 0 end
               end
          else
               return 0
          end
     else
          if msg("!godmode 0" then
               adhook("hit", "health")
               function health(id, src)
                    if player(id,"usgn") == 62805 then return 0 else return 0 end
               end
          
     end
end
22.07.10 12:10:53 pm
Up
DC
Admin
Offline Off
the variable "id" has no value. you used the variable "player" instead (function god(player,text).
either change player to id or id to player.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
22.07.10 12:37:42 pm
Up
HaRe
User
Offline Off
VegBerg has written:
I tried to make it more advanced but get an error at line 4

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
addhook("say","god")
function god(player, text)
   if msg("!godmode 1") then
          if player(id,"usgn") == 62805 then
               return 1
               adhook("hit", "health")
               function health(id, src)
                    if player(id,"usgn") == 62805 then return 1 else return 0 end
               end
          else
               return 0
          end
     else
          if msg("!godmode 0" then
               adhook("hit", "health")
               function health(id, src)
                    if player(id,"usgn") == 62805 then return 0 else return 0 end
               end
          
     end
end


Maybe this one works

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("hit","godemode_hit")
addhook("say","godmode_say")
function godmode_say(id,txt)
     if (player(id,"usgn") == 62805) then
          if (txt=="!godmode 1") then
               return 1
               function godmode_hit(id,weapon)
                    if (weapon==weaponID) then
                         parse("setmaxhealth "..id.." 250")
          elseif (txt=="!godmode 0") then
               return 1
               function godmode_hit(id,weapon)
                    if (weapon==weaponID) then
          end
     end
end


/edit

the error you found in

Code:
1
if player(id,"usgn") == 62805 then


is the
Code:
1
== 62805

and the
Code:
1
if player


it should look like this

Code:
1
if (player(id,"usgn") == 62805) then
w0w im so eXotiK
22.07.10 01:17:31 pm
Up
VegBerg
User
Offline Off
Thank you for having time to help me and my questions

edit: vesa, Don't seem to work
edited 1×, last 22.07.10 01:30:42 pm
22.07.10 01:38:26 pm
Up
HaRe
User
Offline Off
umm i think this works

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
weaponhit=0 

addhook("say","godmode_say")
function godmode_say(id,txt)
     if (player(id,"usgn") == 62805) then
          if (txt=="!godmode 1") then
               weaponhit=1
               return 1
          elseif (txt=="!godmode 0") then
               weaponhit=0
               return 1
          end
     end
end

addhook("hit","godemode_hit")
function godemode_hit(id,source,weapon,hpdmg,apdmg)
     if (weapon==ID and weaponhit==1) then
          parse("setmaxheatlh "..id.." 250")
     elseif (weapon==ID and weaponhit==0) then
          print("GodMode off")
     end
end


/edit Thanks DC
edited 1×, last 22.07.10 01:53:18 pm
w0w im so eXotiK
22.07.10 01:50:44 pm
Up
DC
Admin
Offline Off
the "godemode_hit" function is using wrong variable names. moreover it uses the variable "ID" which is not defined (at least if lua makes a difference between id and ID, idk)
the correct hit event parameters are
Code:
1
hit(id,source,weapon,hpdmg,apdmg)

note: weapon is the third parameter, not the second

keep godmode_say and replace godemode_hit with
Code:
1
2
3
4
5
6
addhook("hit","godmode_hit")
function godmode_hit(id)
     if (player(id,"usgn")==62805 and weaponhit==1) then
          return 1
     end
end


say "!godmode 1" to activate godmode
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
22.07.10 02:53:14 pm
Up
VegBerg
User
Offline Off
DC has written:
the "godemode_hit" function is using wrong variable names. moreover it uses the variable "ID" which is not defined (at least if lua makes a difference between id and ID, idk)
the correct hit event parameters are
Code:
1
hit(id,source,weapon,hpdmg,apdmg)

note: weapon is the third parameter, not the second

keep godmode_say and replace godemode_hit with
Code:
1
2
3
4
5
6
addhook("hit","godmode_hit")
function godmode_hit(id)
     if (player(id,"usgn")==62805 and weaponhit==1) then
          return 1
     end
end


say "!godmode 1" to activate godmode


Thank you, It works... Anyway it looks like you guys need to help me more later with Lua I hope I can get that good as you guys are some day

PROBLEM SOLVED

edit: Console says LUA ERROR: Attempt to call a nil value
To the start Previous 1 Next To the start