When I remove damage from prop_physics, the player still dies from "worldspawn", and when I stop damage form "worldspawn", fall damage/all collision damage is disabled. Is there a way to fix this?
[QUOTE=superdodo12;40712250]When I remove damage from prop_physics, the player still dies from "worldspawn", and when I stop damage form "worldspawn", fall damage/all collision damage is disabled. Is there a way to fix this?[/QUOTE]
This doesnt make any sense.
Worldspawn = fall/collision dmg
prop_physics = props
are you trying to remove both or?
[QUOTE=zerothefallen;40719276]This doesnt make any sense.
Worldspawn = fall/collision dmg
prop_physics = props
are you trying to remove both or?[/QUOTE]
if (attacker:GetClass() == "prop_physics") then return end
is supposed to remove prop damage, but the player still dies from "worldspawn" when a prop lands on him.
so I did this:
if (attacker:GetClass() == "prop_physics" or attacker:GetClass() == "worldspawn") then return end
and that disabled almost all damage, so the player pretty much can't die except for other players/bots shooting.
Perhaps don't negate all damage from worldspawn, only negate DMG_CRUSH ?
EDIT: Nevermind, that would still prevent fall damage
What hook are you using? It seems like you are using EntityTakeDamage or something. Simply returning within the hook isn't going to stop the damage. Setting the damage to 0 on the damageinfo should stop it.
[lua]hook.Add( "EntityTakeDamage", "Stop Prop Damage", function( ent, dmginfo )
local attacker = dmginfo:GetInflictor()
if ent:IsPlayer() and attacker:GetClass() == "prop_physics" then
dmginfo:SetDamage( 0 )
end
end )[/lua]
It'd be more like:
[code]
if inflictor:IsValid( ) and inflictor:GetClass( ) == "prop_physics" then
--prevent damage[/code]
Attacker will be the entity that hit you with the prop ( physics attacker or worldspawn if none is set ).
[QUOTE=Kogitsune;40719995]It'd be more like:
[code]
if inflictor:IsValid( ) and inflictor:GetClass( ) == "prop_physics" then
--prevent damage[/code]
Attacker will be the entity that hit you with the prop ( physics attacker or worldspawn if none is set ).[/QUOTE]
You sure you should do a inflictor:IsValid rather than just inflictor? If inflictor is null you will get an error and if it's not I'm sure the entity is valid.
What he's doing is fine. It's possible for a prop to not have an inflictor/physics attacker thus being NULL.
What I'm saying is that if inflictor is nil then you'll get "attempt to index local 'inflictor' (a nil value)."
Sorry, you need to Log In to post a reply to this thread.