Raised This Month: $ Target: $400
 0% 

Setting an entity's bounds box


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
beeker`
Junior Member
Join Date: Mar 2006
Old 03-23-2006 , 12:05  
Reply With Quote #3

Hey VEN, how's it gion? Here's the whole code:

Code:
/* Plugin generated by AMXX-Studio */   #include <amxmodx>   #include <amxmisc>   #include <engine>   #include <fakemeta>   #define PLUGIN "New Plugin"   #define VERSION "1.0"   #define AUTHOR "Author"   new g_sHE_Nade_Model[] = "models/w_hegrenade.mdl";   new g_sBoxClass[] = "nade_box"; new Float:radius = 5.0; public plugin_init() {           register_plugin( "Shootable Grenades", "0.1", "beeker" );           register_forward( FM_SetModel, "Set_Grenade_Box" );       register_forward( FM_EmitSound, "forward_emit_sound" );         register_concmd( "amx_grenade", "NadeToggle", ADMIN_IMMUNITY, "<1 or 0> Toggle shootable grenades on or off" );     register_cvar( "ToggleValue", "1" );     }   public plugin_precache() {           precache_model( g_sHE_Nade_Model );         precache_sound("debris/bustglass1.wav");       precache_sound("debris/bustglass2.wav");       precache_sound("debris/bustglass3.wav");       precache_sound("debris/glass1.wav");       precache_sound("debris/glass2.wav");       precache_sound("debris/glass3.wav");       precache_sound("debris/glass4.wav");       } public NadeToggle( id, lvl, cid ) {         if( cmd_access( id, lvl, cid, 1 ) ) {                 if( get_cvar_num( "ToggleValue" ) == 1 ) {                     set_cvar_num( "ToggleValue", 0 );             console_print( id, "[AMXX] Shootable grenades disabled" );                         } else {                     set_cvar_num( "ToggleValue", 1 );             console_print( id, "[AMXX] Shootable grenades enabled" );                     }             }         return PLUGIN_HANDLED;     } public forward_emit_sound( eId ) {         if( get_cvar_num( "ToggleValue" ) == 0 )         return PLUGIN_HANDLED;     if( is_valid_ent( eId ) && ( entity_get_int( eId, EV_INT_effects) & EF_NODRAW ) ) {               new sClassname[9];             entity_get_string( eId, EV_SZ_classname, sClassname, 8 );               if( equal( sClassname, g_sBoxClass ) ) {                       new eCloseNade, Float:origin[3];                     entity_get_vector( eId, EV_VEC_origin, origin );             origin[0] += 1.0;                     while( ( eCloseNade = find_ent_in_sphere( eCloseNade, origin, radius ) ) != 0 ) {                             new sNadeClass[8];                 entity_get_string( eCloseNade, EV_SZ_classname, sNadeClass, 7 );                             if( is_valid_ent( eCloseNade ) && equal( sNadeClass, "grenade" ) ) {                                         remove_entity( eId );                     set_pdata_int( eCloseNade, 4, 127173264 );                                     }                         }                     return FMRES_SUPERCEDE;                   }               }       return FMRES_IGNORED;   }   public Set_Grenade_Box( entity, model[] ) {         if( get_cvar_num( "ToggleValue" ) == 0 )         return PLUGIN_HANDLED;     if( !( is_valid_ent( entity ) ) ) {               return FMRES_IGNORED;       }       if(entity_get_edict( entity, EV_ENT_owner ) && equal( model, g_sHE_Nade_Model ) ) {               new eNade = entity;                 new Float:fNadeOrigin[3];                 entity_get_vector( eNade, EV_VEC_origin, fNadeOrigin );           entity_set_int( eNade, EV_INT_solid, SOLID_TRIGGER)             new eBox = create_entity( "func_breakable" );             entity_set_origin( eBox, fNadeOrigin );               entity_set_float( eBox, EV_FL_takedamage, 1.0 );           entity_set_float( eBox, EV_FL_health, 5.0 );               entity_set_string( eBox, EV_SZ_classname, g_sBoxClass );           entity_set_model( eBox, g_sHE_Nade_Model );           //        entity_set_int( eBox, EV_INT_movetype, MOVETYPE_BOUNCE)         entity_set_int( eBox, EV_INT_solid, SOLID_BBOX)                 new Float:mins[3] = { -3.5, -3.5, -3.5 };           new Float:maxs[3] = { 3.5, 3.5, 3.5 };         entity_set_size( eBox, mins, maxs );                 //        new Float:mins[3] = { -20.5, -20.5, -20.5 };           //        new Float:maxs[3] = { 20.5, 20.5, 20.5 };         //    entity_set_size( eBox, mins, maxs );             entity_set_edict( eBox, EV_ENT_aiment, eNade );           entity_set_int( eBox, EV_INT_movetype, MOVETYPE_FOLLOW )           entity_set_int( eBox, EV_INT_sequence, 0 );         }       return FMRES_IGNORED;   }

For some reason, I tried using the debugged version you sent me, but the grenades will not explode no matter what. I had to use get_pdata_int and finally set_pdata_int for it to work.
beeker` 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 16:36.


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