Raised This Month: $ Target: $400
 0% 

C4 Origin & HE Granade Origen


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 02-06-2009 , 21:39   C4 Origin & HE Granade Origen
Reply With Quote #1

Like the Title say... How I can get the Origen of a He When they Explote...

Thanks...
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 02-06-2009 , 21:50   Re: C4 Origin & HE Granade Origen
Reply With Quote #2

http://forums.alliedmods.net/showpos...80&postcount=8

Found this for He Grenade, I'm searching C4 Origin now.
__________________
IneedHelp is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-07-2009 , 04:05   Re: C4 Origin & HE Granade Origen
Reply With Quote #3

PHP Code:
    new bomb;
    if ((
bomb fm_find_ent_by_model(-1"grenade""models/w_c4.mdl"))) {
        new 
Float:vOrigin[3];
        
pev(bombpev_originvOrigin);
        
        
client_print(0print_chat"Bomb Planted @ %.2f %.2f %.2f"vOrigin[0], vOrigin[1], vOrigin[2]);
    } 
__________________

Last edited by xPaw; 02-07-2009 at 04:10.
xPaw is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-07-2009 , 13:30   Re: C4 Origin & HE Granade Origen
Reply With Quote #4

Quote:
Originally Posted by AntiBots View Post
How I can get the Origen of a He When they Explote...
Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #include <hamsandwich> public plugin_init() {     RegisterHam(Ham_Think, "grenade", "FwdExplosion"); } public FwdExplosion(entity) {     if( !pev_valid(entity) ) return HAM_IGNORED;         static Float:dmgtime;     pev(entity, pev_dmgtime, dmgtime);         // not exploding yet     if( get_gametime() > dmgtime ) return HAM_IGNORED;         static model[32];     pev(entity, pev_model, model, sizeof(model) - 1);         static CSW_type;     // 0123456789     // models/w_hegrenade.mdl     // models/w_flashbang.mdl     // models/w_smokegrenade.mdl     // models/w_c4.mdl     switch( model[9] )     {         case 'h': CSW_type = CSW_HEGRENADE;         case 'f': CSW_type = CSW_FLASHBANG;         case 's': CSW_type = CSW_SMOKEGRENADE;         case 'c': CSW_type = CSW_C4;         default: return HAM_IGNORED;     }         static Float:origin[3];     pev(entity, pev_origin, origin);         // "origin" contains the explosion origin     // "CSW_type" contains the CSW_* constant         return HAM_HANDLED; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 02-07-2009 , 13:56   Re: C4 Origin & HE Granade Origen
Reply With Quote #5

To retrieve the C4 exploding location, you can just check where was the bomb site spawned.

Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> #define VERSION    "1.0" new HamHook:fw_BombSpawn; public plugin_precache() {     fw_BombSpawn = RegisterHam(Ham_Spawn, "info_bomb_target", "Forward_BombsSitesSpawn", 1); } public plugin_init() {     register_plugin("Bomb Sites Locations", VERSION, "Dores"); } public Forward_BombsSitesSpawn(site) {     DisableHamForward(fw_BombSpawn); // Remove this line if you're using a custom C4 plugin(like Fake C4).         static Float:flOrigin[3];     pev(site, pev_origin, flOrigin); }
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 02-07-2009 , 14:03   Re: C4 Origin & HE Granade Origen
Reply With Quote #6

Thanks.... +K For All. The Way of v3x dont work.
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-07-2009 , 14:21   Re: C4 Origin & HE Granade Origen
Reply With Quote #7

For C4, alternate way :

Code:
    public plugin_init ()     {         register_event( "51", "Event_C4Explosion", "a", "1=9", "2=2", "4=0", "5=527" );     }         public Event_C4Explosion ()     {         new Float:vecC4Origin[ 3 ];         pev( read_data( 3 ), pev_origin, vecC4Origin );                 log_amx ( "vecC4Origin = %f %f %f", vecC4Origin[ 0 ], vecC4Origin[ 1 ], vecC4Origin[ 2 ] );     }

For He, depending your need, you can use that :

Code:
    public plugin_init ()     {         register_event( "23", "Event_HeExplosion", "a", "1=3", "5=136", "6=30", "7=30" );     }     public Event_HeExplosion ()     {         new Float:vecHeOrigin[ 3 ];         read_data( 2, vecHeOrigin[ 0 ] );         read_data( 3, vecHeOrigin[ 1 ] );         read_data( 4, vecHeOrigin[ 2 ] );                 log_amx ( "vecHeOrigin = %f %f %f", vecHeOrigin[ 0 ], vecHeOrigin[ 1 ], vecHeOrigin[ 2 ] );     }

Not really the exact grenade origin, more the explosion end position.

Last edited by Arkshine; 02-07-2009 at 14:25.
Arkshine is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 02-07-2009 , 15:34   Re: C4 Origin & HE Granade Origen
Reply With Quote #8

@arkshine:

The 5th parameter of the HE explosion is always 193 at the beginning of the explosion.

And from where do you get those events ids?
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ

Last edited by Dores; 02-07-2009 at 15:47.
Dores is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-07-2009 , 15:48   Re: C4 Origin & HE Granade Origen
Reply With Quote #9

The 5th arg is the sprite index. An explosion ( TE_EXPLOSION ) is composed of 2 messages. I just took one.
Arkshine is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 02-07-2009 , 15:57   Re: C4 Origin & HE Granade Origen
Reply With Quote #10

But when I debugged that message("23") and it's args, it always printed: "read_data(5) = 193" at the beginning of the explosion.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores 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 01:50.


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