Raised This Month: $ Target: $400
 0% 

Player should evade all bullets


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DA
Veteran Member
Join Date: Nov 2005
Location: Germany/Münster
Old 06-22-2009 , 14:38   Player should evade all bullets
Reply With Quote #1

Hello guys,

I'm currently working on a function where a player can evade bullets.
First, my simple example.

Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #include <engine> #define PLUGIN "Godmodetest" #define VERSION "1.0" #define AUTHOR "DA" new fLastShotFired[32]; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_forward ( FM_TraceLine, "TRIGGER_TraceLine" );     register_event ( "CurWeapon", "on_CurWeapon", "be", "1=1" ); } public on_CurWeapon( id ) {     fLastShotFired[id] = halflife_time(); } // Called when a user looks somewhere public TRIGGER_TraceLine( Float:v1[3], Float:v2[3], noMonsters, pentToSkip ) {     new iAttacker = pentToSkip;     new iVictim = get_tr(TR_pHit);         // Make sure we have a valid victim     if ( is_user_alive( iVictim ) )     {         // We need to have a valid player!         if ( is_user_alive( iAttacker ) )         {             new Float:fTime = halflife_time();             new Float:fDifference = fTime - fLastShotFired[iAttacker];                         if ( fDifference < 0.1 && fDifference > 0.0 )             {                 client_print( 0, print_chat, "He is the god!" );                                 set_tr( TR_flFraction, 1.0 );                 return FMRES_SUPERCEDE;             }         }     }         return FMRES_IGNORED; }

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
__________________
DA 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 15:32.


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