Raised This Month: $ Target: $400
 0% 

Block knife attack


Post New Thread Reply   
 
Thread Tools Display Modes
Old 12-28-2006, 19:15
Iznogood
This message has been deleted by Iznogood. Reason: Error
Boop
Junior Member
Join Date: Dec 2006
Old 12-28-2006 , 19:17   Re: Block knife attack
Reply With Quote #2

Quote:
Originally Posted by XxAvalanchexX View Post
Either the trace isn't getting stored in the global trace handler, or I don't quite understand hull traces. Try changing the get_tr line to this:

Code:
hit = get_tr2(ptr,TR_pHit);
With this code (hit = get_tr2(ptr, TR_pHit)) , the server crash. I don't know if this will help you to find a solution : I can get an "target" if I use :

Code:
register_forward(FM_TraceHull, "fw_tracehull",1);
.... but this is not useful because I can't block the function no ?? An idea XxAvalanchexX ?
Boop is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-28-2006 , 23:58   Re: Block knife attack
Reply With Quote #3

Are you saying that if you register the forward with the 1 flag, "hit" does come up as something?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 12-29-2006 , 00:23   Re: Block knife attack
Reply With Quote #4

You usually supercede the function if you are messing with tracelines, so your previous version might work.

Thats an interesting bug there with get_tr2, not working in pre functions

[edit]
Just thought I don't think you should be using get_tr2 since this is for manually created tracelines etc.
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd

Last edited by Orangutanz; 12-29-2006 at 00:26.
Orangutanz is offline
Boop
Junior Member
Join Date: Dec 2006
Old 12-29-2006 , 06:09   Re: Block knife attack
Reply With Quote #5

Quote:
Originally Posted by XxAvalanchexX View Post
Are you saying that if you register the forward with the 1 flag, "hit" does come up as something?
Yes, if I register the forward with the 1 flag, I can get ID of player who is attacked by knife. But, we can't block the function if we hook it with the flag 1 no ??
Boop is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 12-29-2006 , 14:21   Re: Block knife attack
Reply With Quote #6

Let's find out, use this...

Code:
new knifeImmune[33] = { true, ... }; public plugin_init() {     register_forward(FM_TraceHull,"fw_tracehull",1); } public fw_tracehull(Float:v1[3],Float:v2[3],noMonsters,hull,skipEnt,ptr); {     // not a player, or a dead one     if(!is_user_connected(skipEnt) || !is_user_alive(skipEnt))         return FMRES_IGNORED;     static hit;     hit = get_tr(TR_pHit);     // an immune player was not hit     (hit <= 0 || hit > 32 || !knifeImmune[hit])         return FMRES_IGNORED;     // override     set_tr(TR_pHit,0);     return FMRES_SUPERCEDE; }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Boop
Junior Member
Join Date: Dec 2006
Old 12-29-2006 , 16:10   Re: Block knife attack
Reply With Quote #7

Quote:
Originally Posted by XxAvalanchexX View Post
Let's find out, use this...

Code:
new knifeImmune[33] = { true, ... }; public plugin_init() { register_forward(FM_TraceHull,"fw_tracehull",1); } public fw_tracehull(Float:v1[3],Float:v2[3],noMonsters,hull,skipEnt,ptr) { // not a player, or a dead one if(!is_user_connected(skipEnt) || !is_user_alive(skipEnt)) return FMRES_IGNORED; static hit; hit = get_tr(TR_pHit); // an immune player was not hit if (hit <= 0 || hit > 32 || !knifeImmune[hit]) return FMRES_IGNORED; // override set_tr(TR_pHit,0); return FMRES_SUPERCEDE; }

This doesn't work It takes without problem "a valid hit" but the damaged are given. It doesn't block them ..... maybe because we call fw_tracehull with the flag 1 no ??

So if we use register_forward without the flag 1, we can't get the id of the player attacked with a knife. If we use register_forward with the flag 1, we can't block the attack with the knife. Is there a solution ? A bug ??
Boop is offline
Boop
Junior Member
Join Date: Dec 2006
Old 01-02-2007 , 15:02   Re: Block knife attack
Reply With Quote #8

Someone else thinks that there is a bug with trace_hull too ?
Boop is offline
lunarwolfx
Member
Join Date: Feb 2005
Old 01-15-2007 , 03:20   Re: Block knife attack
Reply With Quote #9

^wow that's amazing! Great work.
lunarwolfx is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode