My idea was to make a quick function in which it tells all server admins in their console who was killed by a prop and who owned that prop, to prevent prop killing
I ended upp with this code that I put together quickly, would someone please check it over for me and correct/tell me what is wrong so that I may try to fix it
[lua]if (SERVER) then
function WhosPropIsIt( victim, inflictor, killer )
if inflictor:GetDamageType() == DMG_CRUSH then
umsg.Start( "SayPropOwner" )
umsg.String( victim:Nick() )
umsg.String( inflictor:GetPhysicsAttacker():Nick() )
umsg.End()
end
end
hook.Add( "PlayerDeath", "WhosPropIsIt", WhosPropIsIt )
end
if (CLIENT) then
function SayPropOwner( msg )
if !ply:IsAdmin() then return false end
local victim = msg:ReadString()
local killer = msg:ReadString()
print(victim.." Was Killed By "..killer.."'s Prop")
end
usermessage.Hook( "SayPropOwner", SayPropOwner )
end[/lua]
Thanks a lot :D
First of all: Not all props give CRUSH damage, sawblades will give different damage types.
Second: Do not name it "SayPropOwner" as it's kinda generic, and doesn't really fit the need, use something like "MsgPropPhysAttacker"
Third: Change print to Msg, I can be mistaken, but I guess print doesn't quite work.
[code]local function RemovePropDamage(ent, inflictor, attacker, amount, dmginfo)
if ent:IsPlayer() and ((dmginfo:GetDamageType() == DMG_CRUSH) or (dmginfo:GetDamageType() == 5)) then
dmginfo:SetDamage(0)
end
end
hook.Add("EntityTakeDamage", "RemovePropDamage", RemovePropDamage)[/code]
This code I've made quite a long ago would stop prop killing, first check is for normal prop damage, second one will go ahead and check if there was damage from sawblades (SLASH+CRUSH).
I bet there IS a better way of checking it, but I'm too lazy to see how to deal with those binary checks.
Thanks a lot, that's going to help A LOT :D
Woo woop.
Very useful.
Anyway of making it so the prop does not collide with player on hit.
[QUOTE=Queer Flawless;28642611]Woo woop.
Very useful.
Anyway of making it so the prop does not collide with player on hit.[/QUOTE]
This is from an old backup, I had one that didn't collide, must be quite easy to do so.
Where would i put this brillian code?
Sorry, you need to Log In to post a reply to this thread.