• player died hook ?
    4 replies, posted
i recently made the killcounter from the wiki, [url]http://wiki.garrysmod.com/?title=Kill_Counter[/url] now i want it to count player and npc kills, but i couldnt find a function or hook that is called when a player dies, for npc you just use a hook : OnNPCKilled, can someone pls point me in the right direction? (something that is called everytime a player dies) in case theres nothing similar to that, i could maybe create a hook that checks for players getting hurt + detect if they are still alive or not [code] function GM:EntityTakeDamage( ent, inflictor, attacker, amount ) if ( ent:IsPlayer() ) && !Player.Alive() then hook.Call("PlayerDied", self, ent, inflictor, attacker, amount) end end [/code] (started with lua 2 days ago, plz halp)
thx dude, i knew it was hidden somewhere in the wiki
hook.Add("PlayerDeath", blah, blah)
[QUOTE=thejjokerr;22977829]When the player dies: [b][url=wiki.garrysmod.com/?title=Gamemode.PlayerDeath]Gamemode.PlayerDeath [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] When he has already died:[b][url=wiki.garrysmod.com/?title=Gamemode.DoPlayerDeath]Gamemode.DoPlayerDeath [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b][/QUOTE] You got them reversed, it's DoPlayerDeath for when they are going to die, and PlayerDeath when they have died
Sorry, you need to Log In to post a reply to this thread.