It's all about Dodgeball.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include < amxmodx >
new const g_szDodgeballViewModel[] = "models/Days/v_dodgeball.mdl";
new const g_szDodgeballWeaponModel[] = "models/Days/p_dodgeball.mdl";
new const g_szDodgeballWorldModel[] = "models/Days/w_dodgeball.mdl";
new const g_szDodgeballSound[] = "Days/dodgeball_bounce.wav";
public plugin_init()
{
register_message( get_user_msgid( "TextMsg" ), "Message_TextMsg" );
register_event( "CurWeapon", "Event_CurWeapon", "be", "1=1" );
register_think( "grenade", "GrenadeThink" );
register_touch( "*"," player", "PlayerInteract" );
register_touch( "grenade", "*", "BallInteract" );
register_forward( FM_SetModel, "FwdSetModel_Pre", 0 );
register_forward( FM_EmitSound, "FwEmitSound_Pre", 0 );
register_forward( FM_CmdStart, "FwCmdStart_Pre", 0 );
RegisterHam( Ham_Item_Deploy, "weapon_hegrenade", "FwdDodgeballDeploy_Post", 1 );
}
public plugin_precache()
{
static precache[ 128 ];
PrecacheSongs();
precache_sound( g_szDodgeballSound );
precache_model( g_szDodgeballViewModel );
precache_model( g_szDodgeballWeaponModel );
precache_model( g_szDodgeballWorldModel );
}
public FwdSetModel_Pre( iEnt, szModel[] )
{
if ( g_iCurrentDay != DODGEBALL_DAY )
return 1;
if ( equali( szModel, "models/w_hegrenade.mdl" ) )
{
entity_set_model( iEnt, g_szDodgeballWorldModel );
set_task( 10.0, "RemoveEnt", iEnt );
return 4;
}
return 1;
}
public RemoveEnt( iEnt )
{
if ( pev_valid( iEnt ) ) remove_entity( iEnt );
remove_task( iEnt );
}
public FwEmitSound_Pre( iEntity, iChannel, szSample[], Float:fVolume, Float:fAtten, iFlags, iPitch )
{
if ( g_iCurrentDay != DODGEBALL_DAY )
return FMRES_IGNORED;
if( containi( szSample, "he_bounce" ) != -1 )
{
if( entity_get_float( iEntity, EV_FL_fuser1 ) + 0.3 < get_gametime() )
{
entity_set_float(iEntity, EV_FL_fuser1, get_gametime() );
emit_sound( iEntity, CHAN_ITEM, g_szDodgeballSound, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
}
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
public FwdDodgeballDeploy_Post( iEnt )
{
if ( g_iCurrentDay != DODGEBALL_DAY )
return 1;
static client;
client = get_pdata_cbase( iEnt, 41, 4 );
if ( !is_user_alive( client ) )
return 1;
set_pev( client, pev_viewmodel2, g_szDodgeballViewModel );
set_pev( client, pev_weaponmodel2, g_szDodgeballWeaponModel );
return 4;
return 0;
}
public Event_CurWeapon( client )
{
if ( !is_user_alive( client ) )
return 1;
static CsTeams:iTeam, iWeapon;
iTeam = cs_get_user_team( client )
iWeapon = get_user_weapon( client );
if ( iTeam != CS_TEAM_T && IsTerrorDay( g_iCurrentDay ) )
{
fm_strip_user_weapons( client );
return 1;
}
case DODGEBALL_DAY:
{
if ( iTeam == CS_TEAM_T && iWeapon != CSW_HEGRENADE )
{
fm_strip_user_weapons( client );
fm_give_item( client, "weapon_hegrenade" );
cs_set_user_bpammo( client, CSW_HEGRENADE, 999 );
}
}
}
return 1;
}
public GrenadeThink( iEnt )
{
if ( g_iCurrentDay != DODGEBALL_DAY )
return 0;
return 1;
return 0;
}
public PlayerInteract( iEnt, client )
{
if ( g_iCurrentDay != DODGEBALL_DAY || cs_get_user_team( client ) != CS_TEAM_T )
return 0;
static szClass[ 32 ];
entity_get_string( iEnt, EV_SZ_classname, szClass, charsmax( szClass ) );
if ( equali( szClass, "grenade" ) )
PlayerHitByBall( client, iEnt );
return 0;
}
public BallInteract( iBall, iEnt )
{
if ( g_iCurrentDay != DODGEBALL_DAY )
return 0;
if( iEnt == 0)
{
entity_set_int( iBall, EV_INT_iuser1, 1);
fm_set_rendering( iBall );
}
else
{
static szClass[ 32 ];
entity_get_string( iEnt, EV_SZ_classname, szClass, charsmax( szClass ) );
if( equali( szClass, "func_", 5 ) )
{
entity_set_int( iBall, EV_INT_iuser1, 1 );
set_rendering( iBall );
new Float:fStart[ 3 ], Float:fEnd[ 3 ], Float:fGround[ 3 ];
entity_get_vector( iBall, EV_VEC_origin, fStart );
fEnd = fStart;
fEnd[ 2 ] -= 1024.0;
trace_line( iEnt, fStart, fEnd, fGround );
fGround[ 2 ] += 7.0;
entity_set_vector( iBall, EV_VEC_origin, fGround );
}
}
return 0;
}
public PlayerHitByBall( client, iBall )
{
if ( g_iCurrentDay != DODGEBALL_DAY )
return 0;
if ( entity_get_int( iBall, EV_INT_iuser1 ) == 1)
{
remove_entity( iBall );
return 0;
}
static iOwner;
iOwner = entity_get_edict( iBall, EV_ENT_euser1 );
if ( iOwner == client )
{
entity_set_int( iBall, EV_INT_iuser1, 1 );
fm_set_rendering( iBall );
return 0;
}
if ( cs_get_user_team( client ) == CS_TEAM_T )
{
static Float:fOrigin[ 3 ], Float:fVec[ 3 ];
entity_get_vector( iBall, EV_VEC_origin, fOrigin );
get_velocity_from_origin( client, fOrigin, 5120.0, fVec );
fVec[ 2 ] = 512.0;
entity_set_vector( client, EV_VEC_velocity, fVec );
static Float:fMaxs[ 3 ], Float:f_pOrigin[ 3 ], iHeadshot = 0;
entity_get_vector( client, EV_VEC_maxs, fMaxs );
entity_get_vector( client, EV_VEC_origin, f_pOrigin );
f_pOrigin[ 2 ] += fMaxs[ 2 ];
if( vector_distance( fOrigin, f_pOrigin ) <= 26.3 )
iHeadshot = 1
make_deathmsg( iOwner, client, iHeadshot, "dodgeball" );
user_silentkill( client );
remove_entity( iBall );
static iEnt = 0, szModel[ 120 ];
while( ( iEnt = find_ent_by_class( iEnt, "armoury_entity" ) ) != 0 )
{
entity_get_string( iEnt, EV_SZ_model, szModel, charsmax( szModel ) );
if ( equali( szModel, g_szDodgeballViewModel )
|| equali( szModel, g_szDodgeballWeaponModel )
|| equali( szModel, g_szDodgeballWorldModel ) )
remove_entity( iEnt );
}
}
return 0;
}
public Message_TextMsg()
{
if ( g_iCurrentDay != DODGEBALL_DAY )
return 0;
new szMsg[ 32 ];
get_msg_arg_string( 2, szMsg, charsmax( szMsg ) );
if( equali( szMsg, "#Weapon_Cannot_Be_Dropped" ) )
return 1;
if( str_to_num( szMsg ) > 0 )
{
get_msg_arg_string( 3, szMsg, charsmax( szMsg ) );
if( equali( szMsg, "#Game_radio" ) )
{
get_msg_arg_string( 5, szMsg, charsmax( szMsg ) );
if( equali( szMsg, "#Fire_in_the_hole" ) )
return 1;
}
}
return 0;
}