So... Short story is - I've got weapon_ttt_knife, what I want to do is - When the knife is thrown or someone is stabbed to death, give the attacker/thrower a new knife.
I've tried doing the following on my server but it didn't work -
[CODE]hook.Add("PlayerDeath", kniferound, function(victim, inflictor, v)
if v:IsValid() and v:IsPlayer() and v:Alive() then
v:Give( "weapon_ttt_knife" )
v:SetActiveWeapon ( "weapon_ttt_knife" )
end
end)
[/CODE]
I've thought about adding hook to Drop but I don't know what's the name of the hook nor how to do it.
Thanks in advance
Untested it may or may not work
[CODE]
hook.Add("PlayerDeath", "kniferound", function(victim, inflictor, v)
if v:IsValid() and v:IsPlayer() and v:Alive() then
v:Give( "weapon_ttt_knife" )
else
if ( v:DropWeapon == "weapon_ttt_knife" ) then
v:Give( "weapon_ttt_knife" )
end
end
end)
[/CODE]
That code gives the weapon to the player while it is dead.
Sorry, you need to Log In to post a reply to this thread.