• Anti prop kill
    9 replies, posted
I just need a basic anti prop kill maybe just where people dont take damage from props
[url]http://coderhire.com/scripts/view/43[/url]
[QUOTE=Busan1;42050878][url]http://coderhire.com/scripts/view/43[/url][/QUOTE] Ew, no. Use the PlayerShouldTakeDamage hook, it returns the victim and the entity attacking, so you can check if it is a prop attempting to deal damage to a player. I believe that if you return false the victim takes no damage so... [lua] function GM:PlayerShouldTakeDamage(ply,att) if !att:IsPlayer() then return false end return true end [/lua]
[QUOTE=Internet1001;42051083]Ew, no. Use the PlayerShouldTakeDamage hook, it returns the victim and the entity attacking, so you can check if it is a prop attempting to deal damage to a player. I believe that if you return false the victim takes no damage so... [lua] function GM:PlayerShouldTakeDamage(ply,att) if !att:IsPlayer() then return false end return true end [/lua][/QUOTE] Except that the prop is not always the attacker. Since you can be pushed into the world it can be the attacker.
Why not use the should collide hook and check if ent1 is a prop and its velocity is above a certain speed and ent2 is a player and return false?
If you're looking to code it yourself, sure, we can help. But if you're looking for coders, and script handouts, check out coderhire.com - The developers forum is for developers to come together and discuss Lua, to ask help why specific things aren't working or to get help fixing their scripts; not to beg for scripts. As said above, you can hook into PlayerShoutTakeDamage. If a prop is hurting you, the attacker is either going to be the prop, or the world. Easiest way to check ( when the world is returned ) is do an area search and see if a prop is making contact with the player at that exact moment; if so it's a prop doing the damage and not the world.
[QUOTE=Acecool;42052580]If you're looking to code it yourself, sure, we can help. But if you're looking for coders, and script handouts, check out coderhire.com - The developers forum is for developers to come together and discuss Lua, to ask help why specific things aren't working or to get help fixing their scripts; not to beg for scripts. As said above, you can hook into PlayerShoutTakeDamage. If a prop is hurting you, the attacker is either going to be the prop, or the world. Easiest way to check ( when the world is returned ) is do an area search and see if a prop is making contact with the player at that exact moment; if so it's a prop doing the damage and not the world.[/QUOTE] Then someone landing on a prop would not die. PEople could just drop a prop then jump on it to get down a cliff. Like some kind of metallic trampoline
Add 1 more piece of logic then: Is a player holding the prop? If so, then no damage. Think :-)
[QUOTE=Acecool;42058669]Add 1 more piece of logic then: Is a player holding the prop? If so, then no damage. Think :-)[/QUOTE] And what if someone holds the prop while falling?
You can check velocity on the prop too, on impact, if the velocity is under a certain speed then treat it as a stationary object ( and if falling deal damage )
Sorry, you need to Log In to post a reply to this thread.