• Print

Author Topic: Help with modding Murder gamemode..  (Read 16053 times)

0 Members and 1 Guest are viewing this topic.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Help with modding Murder gamemode..
« Reply #15 on: February 03, 2014, 09:21:35 pm »
Code: Lua
  1. local function IgniteBystander( victim, inflictor, attacker )
  2.  
  3.         if not attacker:GetMurderer() and not victim:GetMurderer() then
  4.                 attacker:Ignite()
  5.         end
  6.  
  7. end
  8. hook.Add("PlayerDeath", "BystanderPunishment", IgniteBystander)
  9.  

That should work.
« Last Edit: February 03, 2014, 09:46:40 pm by Neku »
Out of the Garry's Mod business.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Help with modding Murder gamemode..
« Reply #16 on: February 03, 2014, 09:38:52 pm »
you forgot your parenthesis in your second GetMurderer()

Offline VonTreece

  • Newbie
  • *
  • Posts: 25
  • Karma: 1
Re: Help with modding Murder gamemode..
« Reply #17 on: February 03, 2014, 09:43:01 pm »
Alright, going to try using this code here:

Code: [Select]
function IgniteBystander(victim,inflictor,attacker)

if not attacker:GetMurderer() and not victim:GetMurderer() then
attacker:Ignite(30)
end
end
hook.Add("PlayerDeath", "BystanderPunishment", IgniteBystander)

Will post results!

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Help with modding Murder gamemode..
« Reply #18 on: February 03, 2014, 09:45:39 pm »
you forgot your parenthesis in your second GetMurderer()

Haha, whoops!
Out of the Garry's Mod business.

Offline VonTreece

  • Newbie
  • *
  • Posts: 25
  • Karma: 1
Re: Help with modding Murder gamemode..
« Reply #19 on: February 03, 2014, 10:51:28 pm »
Works flawlessly! (No errors either!)

Thank you all for your help!

For anyone who's interested here's the code used:

Code: [Select]
function IgniteBystander(victim,inflictor,attacker)

if not attacker:GetMurderer() and not victim:GetMurderer() then
attacker:Ignite(30)
end
end
hook.Add("PlayerDeath", "BystanderPunishment", IgniteBystander)

Thanks again!

Offline Storm

  • Full Member
  • ***
  • Posts: 220
  • Karma: 4
Re: Help with modding Murder gamemode..
« Reply #20 on: February 05, 2014, 03:35:11 am »
I am very interested I have the exact same problem! Is what you last posted the only thing that needs to be changed? Where in the files did you wind up putting the code? Does this actually kill the player? This will be great for Murder servers!

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Help with modding Murder gamemode..
« Reply #21 on: February 05, 2014, 11:12:57 pm »
I am very interested I have the exact same problem! Is what you last posted the only thing that needs to be changed? Where in the files did you wind up putting the code? Does this actually kill the player? This will be great for Murder servers!

If you want them to die, use something like:

Code: Lua
  1. local function KillBystander( victim, inflictor, attacker )
  2.  
  3.         if not attacker:GetMurderer() and not victim:GetMurderer() then
  4.                 attacker:Kill() -- Watch RDMers suffer ;)
  5.         end
  6.  
  7. end
  8. hook.Add("PlayerDeath", "BystanderPunishment", KillBystander)
Out of the Garry's Mod business.

Offline VonTreece

  • Newbie
  • *
  • Posts: 25
  • Karma: 1
Re: Help with modding Murder gamemode..
« Reply #22 on: February 06, 2014, 02:41:55 am »
I am very interested I have the exact same problem! Is what you last posted the only thing that needs to be changed? Where in the files did you wind up putting the code? Does this actually kill the player? This will be great for Murder servers!

Yep! All you need to do is save the code as a .lua (e.g. - ignitebystander.lua) and then add it directly in to "garrysmod/lua/autorun/server".

It will ignite and eventually kill any bystander who kills an innocent bystander.

If you'd like to instantly kill rather than ignite a player, refer to Neku's post above. ^

  • Print