Raised This Month: $ Target: $400
 0% 

forward_return and FMRES_OVERRIDE


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-22-2007 , 23:32   forward_return and FMRES_OVERRIDE
Reply With Quote #1

This is for my Weapon Immunity plugin, to make players immune to the HE grenade. The idea is to stop a grenade's FindEntityInSphere from returning any players that are immune. This is my code:

Code:
 public plugin_init()  {     register_forward(FM_FindEntityInSphere,"fw_sphere",0);  }  public fw_sphere(start,Float:origin[3],Float:radius)  {     // not a grenade's radius     if(radius != 350.0) return FMRES_IGNORED;     // run the same check to see what its result will be     new hit = engfunc(EngFunc_FindEntityInSphere,start,origin,radius);     if(is_user_alive(hit) && immune[hit][CSW_HEGRENADE])     {         // run another check to see who should be hit instead of me         hit = engfunc(EngFunc_FindEntityInSphere,hit,origin,radius);         client_print(0,print_chat,"* You got hit by a grenade! Returning instead: %i",hit);         forward_return(FMV_CELL,hit);         return FMRES_OVERRIDE;     }     return FMRES_IGNORED;  }

immune[hit][CSW_HEGRENADE] is true.

Part of this works, in that I can't take any damage from HE grenades. The message comes up and gives me a valid entity index that isn't me. The problem is that this seemingly stops any more checks from being called afterwards:

If I get a bot and turn on friendlyfire, make myself immune and him not, when I throw a grenade at us both, it tells me that I was hit by a grenade, and that it is instead returning 2 (the bot). However, the bot takes no damage (and neither do I, since I'm immune). This is the same functionality as if I were to return FMRES_SUPERCEDE.

Why wouldn't this be working?

Thanks.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
 



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:26.


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