AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   C4 Origin & HE Granade Origen (https://forums.alliedmods.net/showthread.php?t=85177)

AntiBots 02-06-2009 21:39

C4 Origin & HE Granade Origen
 
Like the Title say... How I can get the Origen of a He When they Explote...

Thanks...

IneedHelp 02-06-2009 21:50

Re: C4 Origin & HE Granade Origen
 
http://forums.alliedmods.net/showpos...80&postcount=8

Found this for He Grenade, I'm searching C4 Origin now.

xPaw 02-07-2009 04:05

Re: C4 Origin & HE Granade Origen
 
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]);
    } 


Exolent[jNr] 02-07-2009 13:30

Re: C4 Origin & HE Granade Origen
 
Quote:

Originally Posted by AntiBots (Post 757125)
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; }

Dores 02-07-2009 13:56

Re: C4 Origin & HE Granade Origen
 
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); }

AntiBots 02-07-2009 14:03

Re: C4 Origin & HE Granade Origen
 
Thanks.... +K For All. The Way of v3x dont work.

Arkshine 02-07-2009 14:21

Re: C4 Origin & HE Granade Origen
 
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.

Dores 02-07-2009 15:34

Re: C4 Origin & HE Granade Origen
 
@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?

Arkshine 02-07-2009 15:48

Re: C4 Origin & HE Granade Origen
 
The 5th arg is the sprite index. An explosion ( TE_EXPLOSION ) is composed of 2 messages. I just took one.

Dores 02-07-2009 15:57

Re: C4 Origin & HE Granade Origen
 
But when I debugged that message("23") and it's args, it always printed: "read_data(5) = 193" at the beginning of the explosion.


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

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