Player should evade all bullets
Hello guys,
I'm currently working on a function where a player can evade bullets. First, my simple example. Code:
How you see that I make it with Trigger_TraceLine. Why? Because in my real plugin the player should have only a chance to evade a bullet. Well. I've tested this function on my localmachine but it's not working. Maybe you have an idea why or better - a better way to do it. Thanks in advance for any help. DA |
Re: Player should evade all bullets
PHP Code:
|
Re: Player should evade all bullets
ham_takedmg -> dmgtype == DMG_BULLET -> if( random_num(0,100) < PERCETNAGE_CHANCE ) return HAM_SUPERCEDE
edit: snow was faster -.- edit2: new fLastShotFired[32]; -> new fLastShotFired[33]; |
Re: Player should evade all bullets
Better to hook TraceAttack.
|
Re: Player should evade all bullets
You can use traceline if you want...
PHP Code:
|
Re: Player should evade all bullets
you can traceline but its inefficient, also traceattack and takedmg shouldnt make any difference since you have to check the dmgtype and supercede the hook if the player evaded.
|
Re: Player should evade all bullets
Quote:
PHP Code:
|
Re: Player should evade all bullets
Thank you all for your response. But I have a little problem.
I have forgot to say that I need the Hitzone. Is it maybe possible to get the Hitzone with TraceAttack or the TakeDamage event? (with hamsandwich) I found this in the ham_const.inc Code:
/** |
Re: Player should evade all bullets
You can retrieve it from the trace handle in TraceAttack, or by player offset m_LastHitGroup (= 75 in cs and cz) in TraceAttack.
|
Re: Player should evade all bullets
Ham_TraceAttack(plr, idattacker, Float:damage, Float:direction[3], tracehandle, damagebits) -> hitgroup = get_tr2( tracehandle, TR_iHitgroup ) (not sure whetehr there is a typo anywhere, my time runs out ^^)
|
| All times are GMT -4. The time now is 15:32. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.