Veteran Member
|
08-15-2012
, 13:18
[ZP] Extra Item: Bubble Grenade (zombies atraviesan la bubble)
|
#1
|
Hola buenas, tengo un problema con la 'Bubble Grenade', resulta que la compro y al tirarla al suelo se
crea la burbuja, pero los zombies pueden entrar perfectamente, es como si no estuviera, pero el
modelo si que esta, bueno alguna solucion ?
Muchas gracias.
[ZP] Extra Item: Bubble Grenade
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <chatcolor>
#include <engine>
#include <fakemeta_util>
#include <hamsandwich>
#include <zombieplague>
#define VERSION "2.2"
#define BUBBLE_TIME_NAME "Bubble Grenade (Short-Time)"
#define BUBBLE_ROUND_NAME "Bubble Grenade (Complete Round)"
#define is_valid_touch(%1) (is_user_alive(%1) && (zp_get_user_zombie(%1) || zp_get_user_nemesis(%1)))
#define BUBBLE_TASK
// #define BUBBLE_ROUND
// #define ONE_COLOR
#define RANDOM_COLOR
new const NADE_TYPE_BUBBLE = 3679
#if defined ONE_COLOR
new Float: fBubble_Color[ 3 ] =
{
255.0, // R
0.0, // G
0.0 // B
};
#endif
new iTrailColor[ 3 ] =
{
000, // R
255, // G
255 // B
};
new Float: fMins[ 3 ] = { -100.0, -100.0, -100.0 };
new Float: fMaxs[ 3 ] = { 100.0, 100.0, 100.0 };
new const szEnt_BubbleGrenade[ ] = "bubble_grenade";
new const szPlayer_BubbleGrenade[ ] = "models/zombie_plague/bubble_grenade/p_bubblegrenade.mdl";
new const szView_BubbleGrenade[ ] = "models/zombie_plague/bubble_grenade/v_bubblegrenade.mdl";
new const szWorld_BubbleGrenade[ ] = "models/zombie_plague/bubble_grenade/w_bubblegrenade.mdl";
new const szBubbleModel[ ] = "models/zombie_plague/bubble_grenade/bubble.mdl";
new g_iTrailSpr;
new const szSprite_GrenadeTrail[ ] = "sprites/laserbeam.spr";
new g_pCvarBGPushingForce, g_pCvarBGFlareGrenades;
new g_iBubbleGrenade, g_iBubbleId;
const szBubbleCost = 30;
public plugin_init( )
{
register_plugin( "[ZP] Extra Item: Bubble Grenade", VERSION, "Luqqas" );
// Push cvar, only float's numbers.
g_pCvarBGPushingForce = register_cvar( "zp_pushing_force", "13.0" );
g_pCvarBGFlareGrenades = get_cvar_pointer( "zp_flare_grenades" );
RegisterHam( Ham_Killed, "player", "Fw_PlayerKilled" );
RegisterHam( Ham_Think, "grenade", "Fw_ThinkGrenade" );
RegisterHam( Ham_Item_Deploy, "weapon_smokegrenade", "Fw_Item_Deploy", 1 );
register_forward( FM_SetModel, "Fw_SetModel" );
register_forward( FM_Touch, "Fw_Touch" );
register_event( "HLTV", "Event_HLTV", "a", "1=0", "2=0" );
#if defined BUBBLE_ROUND
g_iBubbleId = zp_register_extra_item( BUBBLE_ROUND_NAME, szBubbleCost * 2 , ZP_TEAM_HUMAN );
#else
g_iBubbleId = zp_register_extra_item( BUBBLE_TIME_NAME, szBubbleCost, ZP_TEAM_HUMAN );
#endif
}
public plugin_precache( )
{
engfunc( EngFunc_PrecacheModel, szPlayer_BubbleGrenade );
engfunc( EngFunc_PrecacheModel, szView_BubbleGrenade );
engfunc( EngFunc_PrecacheModel, szWorld_BubbleGrenade );
engfunc( EngFunc_PrecacheModel, szBubbleModel );
g_iTrailSpr = engfunc( EngFunc_PrecacheModel, szSprite_GrenadeTrail );
}
public zp_extra_item_selected( iPlayer, iItemId )
{
if( iItemId == g_iBubbleId )
{
if( g_iBubbleGrenade & ( 1 << ( iPlayer % 32 ) ) )
ChatColor( iPlayer, "!g[ Bubble Grenade ] !yYou already have a bubble." );
else
{
g_iBubbleGrenade |= ( 1 << ( iPlayer % 32 ) )
if( !user_has_weapon( iPlayer, CSW_SMOKEGRENADE ) )
fm_give_item( iPlayer, "weapon_smokegrenade" );
#if defined BUBBLE_ROUND
ChatColor( iPlayer, "!g[ Bubble Grenade ] !yYou bought a bubble!. This, lasts 1 round complete." );
#else
ChatColor( iPlayer, "!g[ Bubble Grenade ] !yYou bought a bubble!. This, lasts very little!" );
#endif
}
}
}
public zp_user_infected_post( iInfected, iInfector )
{
if( g_iBubbleGrenade & ( 1 << ( iInfected % 32 ) ) )
g_iBubbleGrenade &= ~( 1 << ( iInfected % 32 ) );
}
public Fw_PlayerKilled( iVictim, iAttacker, iShouldGib )
{
if( ( 1 <= iAttacker <= 32 ) && ( g_iBubbleGrenade & ( 1 << ( iVictim % 32 ) ) ) )
g_iBubbleGrenade &= ~( 1 << ( iVictim % 32 ) )
}
public Fw_ThinkGrenade( iEnt )
{
if( !pev_valid( iEnt ) )
return HAM_IGNORED;
static Float: fDmgTime;
pev( iEnt, pev_dmgtime, fDmgTime )
if( fDmgTime > get_gametime( ) )
return HAM_IGNORED;
if( pev( iEnt, pev_flTimeStepSound ) == NADE_TYPE_BUBBLE )
create_ent( iEnt )
return HAM_SUPERCEDE;
}
create_ent( id )
{
set_pcvar_num( g_pCvarBGFlareGrenades, 1 )
new iEnt = create_entity( "info_target" )
if( !is_valid_ent( iEnt ) )
return PLUGIN_HANDLED;
new Float: fOrigin[ 3 ];
entity_get_vector( id, EV_VEC_origin, fOrigin )
entity_set_string( iEnt, EV_SZ_classname, szEnt_BubbleGrenade )
entity_set_vector( iEnt, EV_VEC_origin, fOrigin )
entity_set_model( iEnt, szBubbleModel )
entity_set_int( iEnt, EV_INT_solid, SOLID_TRIGGER )
entity_set_size( iEnt, fMins, fMaxs )
entity_set_int( iEnt, EV_INT_renderfx, kRenderFxGlowShell )
entity_set_int( iEnt, EV_INT_rendermode, kRenderTransAlpha )
entity_set_float( iEnt, EV_FL_renderamt, 50.0 )
#if defined BUBBLE_TASK
set_task( 13.0, "delete_entity", iEnt )
#endif
#if defined ONE_COLOR
entity_set_vector( iEnt, EV_VEC_rendercolor, fBubble_Color )
#endif
#if defined RANDOM_COLOR
if( is_valid_ent( iEnt ) )
{
new Float: fColor[ 3 ];
for( new i; i < 3; i++ )
fColor[ i ] = random_float( 0.0, 255.0 )
entity_set_vector( iEnt, EV_VEC_rendercolor, fColor )
}
#endif
return PLUGIN_CONTINUE;
}
public delete_entity( iEnt )
{
if( is_valid_ent( iEnt ) )
remove_entity( iEnt );
}
public Fw_Item_Deploy( iEnt )
{
if( pev_valid( iEnt ) != 2 )
return HAM_IGNORED;
static const mPlayer = 41;
new id = get_pdata_cbase( iEnt, mPlayer, 4 );
if( ( g_iBubbleGrenade & ( 1 << ( id % 32 ) ) ) && !zp_get_user_zombie( id ) )
{
set_pev( id, pev_weaponmodel2, szPlayer_BubbleGrenade );
set_pev( id, pev_viewmodel2, szView_BubbleGrenade );
}
return HAM_IGNORED;
}
public Fw_SetModel( iEnt, const szModel[ ] )
{
static Float: fDmgTime;
pev( iEnt, pev_dmgtime, fDmgTime )
if( fDmgTime == 0.0 )
return FMRES_IGNORED;
if( equal( szModel[ 7 ], "w_sm", 4 ) )
{
new iOwner = pev( iEnt, pev_owner );
if( is_user_alive( iOwner ) && !zp_get_user_zombie( iOwner ) && ( g_iBubbleGrenade & ( 1 << ( iOwner % 32 ) ) ) )
{
set_pcvar_num( g_pCvarBGFlareGrenades, 0 )
fm_set_rendering( iEnt, kRenderFxGlowShell, 000, 255, 255, kRenderNormal, 16 )
message_begin( MSG_BROADCAST, SVC_TEMPENTITY )
write_byte( TE_BEAMFOLLOW )
write_short( iEnt )
write_short( g_iTrailSpr )
write_byte( 10 )
write_byte( 10 )
write_byte( iTrailColor[ 0 ] ) // R
write_byte( iTrailColor[ 1 ] ) // G
write_byte( iTrailColor[ 2 ] ) // B
write_byte( 500 ) // Brightness.
message_end( )
set_pev( iEnt, pev_flTimeStepSound, NADE_TYPE_BUBBLE )
set_task( 6.0, "delete_entity_grenade", iEnt )
g_iBubbleGrenade &= ~( 1 << ( iOwner % 32 ) )
entity_set_model( iEnt, szWorld_BubbleGrenade )
return FMRES_SUPERCEDE;
}
}
return FMRES_IGNORED;
}
public delete_entity_grenade( iEnt )
{
if( is_valid_ent( iEnt ) )
remove_entity( iEnt )
}
public Fw_Touch( iEnt, iTouched )
{
if( !pev_valid( iEnt ) )
return FMRES_IGNORED;
static g_iEntClass[ 32 ];
pev( iEnt, pev_classname, g_iEntClass, charsmax( g_iEntClass ) );
if( strcmp( g_iEntClass, szBubbleModel ) == 0 )
{
if( is_valid_touch( iTouched ) )
{
static Float: fPos_Ptr[ 3 ], Float: fPos_Ptd[ 3 ];
new Float: fPush_Power = get_pcvar_float( g_pCvarBGPushingForce );
pev( iEnt, pev_origin, fPos_Ptr )
pev( iTouched, pev_origin, fPos_Ptd )
for( new i = 0; i < 3; i++ )
{
fPos_Ptd[ i ] -= fPos_Ptr[ i ]
fPos_Ptd[ i ] *= fPush_Power
}
set_pev( iTouched, pev_velocity, fPos_Ptd )
set_pev( iTouched, pev_impulse, fPos_Ptd )
}
}
return PLUGIN_HANDLED;
}
public Event_HLTV( )
{
#if defined BUBBLE_ROUND
remove_entity_name( szEnt_BubbleGrenade )
#endif
g_iBubbleGrenade = 0;
}
public client_disconnect( id )
g_iBubbleGrenade &= ~( 1 << ( id % 32 ) )
__________________
Last edited by leonard19941; 08-15-2012 at 17:52.
|
|