Pivity

Create a Hook for a Job?

Last read Never
#1

Excuse the Title if its unclear.


So I was wondering if it would be possible to write a Hook that if a Player with that certain Job gets Killed he Explodes.

I have 0 LUA experience but I'd imagine it be easy.

Thanks in advance.

#2

https://wiki.facepunch.com/gmod/GM:PlayerDeath

Check if the player's team is equal to that job, and if they are create the explosion.

hook.Add("PlayerDeath", "some.hook", function(victim)
  if(victim:Team() == TEAM_CITIZEN) then -- If the victim's team is equal to TEAM_CITIZEN
    -- Boom Time
local blast = ents.Create("env_explosion")
blast:SetPos(victim:GetPos())
blast:Spawn()
blast:SetKeyValue("iMagnitide", "200")
blast:Fire("Explode", 0, 0)
  end 
end)


Side note: This thread should've been in this category: https://www.gmodstore.com/community/boards/19 :)

Agree x 2Winner x 1Informative x 1
#3

Thank you so much!


Yeah sorry diddn't know that :/

Friendly x 2
#4

Not sure why but "Boom time" amuses me more than it probably should

Agree x 1Funny x 1
#5

Same XD

Late x 2
Users viewing this thread
Nobody