PHP Code:
#include < amxmodx >
#include < engine >
#include < cstrike >
#include < hamsandwich >
new const g_szGirlsHatModel[] = "models/pinkhat.mdl"
#define PINK_HAT_ACCESS ADMIN_LEVEL_B
new const GLOW_THICKNESS = 1;//the larger the number, the thicker glow is
new const PinkHatColor[] = {196, 68, 171}
new const g_sz_colors[CsTeams][] = {
{},
{255,0,0},
{0,0,255},
{}
};
new const g_szHatModel[ CsTeams ][ ] = {
"",
"models/santahat.mdl",
"models/santahat_blue.mdl",
""
};
new has_phat[33]
new g_iHats[ 33 ];
public plugin_init( ) {
register_plugin( "Santa Hat + Snow", "1.3", "xPaw" );
register_cvar( "santa_hat", "1.3", FCVAR_SERVER );
register_event( "TeamInfo", "EventTeamInfo", "a" );
RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 );
}
public plugin_precache( ) {
// create_entity( "env_snow" );
precache_model( g_szHatModel[ CS_TEAM_T ] );
precache_model( g_szHatModel[ CS_TEAM_CT ] );
precache_model(g_szGirlsHatModel)
}
public client_putinserver(id) {
if(get_user_flags(id) & PINK_HAT_ACCESS)
has_phat[id]=1;
}
public client_disconnect( id ) {
if( is_valid_ent( g_iHats[ id ] ) )
remove_entity( g_iHats[ id ] );
has_phat[id]=0;
}
public FwdHamPlayerSpawn( const id ) {
if( is_user_alive( id ) ) {
new iEntity = g_iHats[ id ];
if( !is_valid_ent( iEntity ) ) {
if( !( iEntity = g_iHats[ id ] = create_entity( "info_target" ) ) )
return;
new CsTeams:iTeam = cs_get_user_team( id );
if( iTeam != CS_TEAM_T && iTeam != CS_TEAM_CT )
iTeam = CS_TEAM_T;
if(has_phat[id]) {
entity_set_model( iEntity, g_szGirlsHatModel)
set_ent_rendering( iEntity, kRenderFxGlowShell, PinkHatColor[0], PinkHatColor[1], PinkHatColor[2], kRenderNormal, GLOW_THICKNESS);//glow for purple hat
}
else {
entity_set_model( iEntity, g_szHatModel[ iTeam ] );
set_ent_rendering( iEntity, kRenderFxGlowShell, g_sz_colors[iTeam][0], g_sz_colors[iTeam][1], g_sz_colors[iTeam][2], kRenderNormal, GLOW_THICKNESS);
}
entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_FOLLOW );
entity_set_edict( iEntity, EV_ENT_aiment, id );
}
}
}
public EventTeamInfo( ) {
new id = read_data( 1 ), iEntity = g_iHats[ id ];
if( !is_valid_ent( iEntity ) ) {
if( iEntity > 0 )
g_iHats[ id ] = 0;
return;
}
new szTeam[ 2 ];
read_data( 2, szTeam, 1 );
if(has_phat[id]) {
entity_set_model( iEntity, g_szGirlsHatModel)
set_ent_rendering( iEntity, kRenderFxGlowShell, PinkHatColor[0], PinkHatColor[1], PinkHatColor[2], kRenderNormal, GLOW_THICKNESS)//glow for purple hat
}
else if( szTeam[ 0 ] == 'C' ) {
entity_set_model( iEntity, g_szHatModel[ CS_TEAM_CT ] );
set_ent_rendering( iEntity, kRenderFxGlowShell, g_sz_colors[CS_TEAM_CT][0], g_sz_colors[CS_TEAM_CT][1], g_sz_colors[CS_TEAM_CT][2], kRenderNormal, GLOW_THICKNESS)//blue glow shell
}
else{
entity_set_model( iEntity, g_szHatModel[ CS_TEAM_T ] );
set_ent_rendering( iEntity, kRenderFxGlowShell, g_sz_colors[CS_TEAM_T][0], g_sz_colors[CS_TEAM_T][1], g_sz_colors[CS_TEAM_T][2], kRenderNormal, GLOW_THICKNESS)//red shell
}
return;
}