Hi. I try to extract form Winter All in One plugin only the christmass tree.
First i have some issues with complier.
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >
#include < fun >
#define PLUGIN_VERSION "1.0.2"
#define AMBIENT_SOUND_LARGERADIUS 8
new i;
//new gCvarEnableTrees;
enum _: iRGB
{
iRed = 0,
iGreen,
iBlue
};
new const szChristmasTreeModels[ ][ ] =
{
"models/aio_winter/christmas_tree_1.mdl",
"models/aio_winter/christmas_tree_2.mdl"
};
new const szChristmasTreeSong[ ] = "aio_winter/merry_christmas.wav";
public plugin_init( )
{
register_plugin( "AIO: Winter Plugin", PLUGIN_VERSION, "tuty" );
register_logevent( "EVENT_RoundStart", 2, "1=Round_Start" );
RegisterHam( Ham_Spawn, "player", "bacon_PlayerSpawn", 1 );
RegisterHam( Ham_Think, "ambient_generic", "bacon_TreeThink", 1 );
//gCvarEnableTrees = register_cvar( "aio_winter_tree", "1" );
}
public plugin_precache( )
{
for( i = 0; i < sizeof szChristmasTreeModels; i++ )
{
precache_model( szChristmasTreeModels[ i ] );
}
precache_sound( szChristmasTreeSong );
}
public bacon_TreeThink( iEntity )
{
if( pev_valid( iEntity ) )
{
set_pev( iEntity, pev_nextthink, get_gametime( ) + 0.8 );
new Float:flOrigin[ 3 ];
pev( iEntity, pev_origin, flOrigin );
UTIL_DynamicLight( flOrigin, random( 256 ), random( 256 ), random( 256 ), 255 );
set_rendering( iEntity, kRenderFxGlowShell, random( 256 ), random( 256 ), random( 256 ), kRenderNormal, random_num( 1, 50 ) );
}
}
UTIL_FindSpawnPoints( )
{
new iCounterTerroristSpawn = engfunc( EngFunc_FindEntityByString, FM_NULLENT, "classname", "info_player_start" );
if( !iCounterTerroristSpawn )
{
return;
}
new Float:flCounterTerroristOrigin[ 3 ];
pev( iCounterTerroristSpawn, pev_origin, flCounterTerroristOrigin );
UTIL_CreateChristmasTree( flCounterTerroristOrigin );
new iTerroristSpawn = engfunc( EngFunc_FindEntityByString, FM_NULLENT, "classname", "info_player_deathmatch" );
if( !iTerroristSpawn )
{
return;
}
new Float:flTerroristOrigin[ 3 ];
pev( iTerroristSpawn, pev_origin, flTerroristOrigin );
UTIL_CreateChristmasTree( flTerroristOrigin );
}
UTIL_CreateChristmasTree( Float:flOrigin[ 3 ] )
{
new iEntity = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "ambient_generic" ) );
if( !pev_valid( iEntity ) )
{
return;
}
new Float:flAngles[ 3 ];
flAngles[ 1 ] += random_float( 1.0, 360.0 );
set_pev( iEntity, pev_message, szChristmasTreeSong );
set_pev( iEntity, pev_spawnflags, AMBIENT_SOUND_LARGERADIUS );
set_pev( iEntity, pev_effects, EF_BRIGHTFIELD );
set_pev( iEntity, pev_origin, flOrigin );
set_pev( iEntity, pev_movetype, MOVETYPE_TOSS );
set_pev( iEntity, pev_health, 1.0 );
set_pev( iEntity, pev_angles, flAngles );
set_pev( iEntity, pev_nextthink, get_gametime( ) + 0.8 );
ExecuteHam( Ham_Spawn, iEntity );
engfunc( EngFunc_SetModel, iEntity, szChristmasTreeModels[ random_num( 0, charsmax( szChristmasTreeModels ) ) ] );
engfunc( EngFunc_DropToFloor, iEntity );
}
UTIL_DynamicLight( Float:flOrigin[ 3 ], r, g, b, a )
{
engfunc( EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, flOrigin );
write_byte( TE_DLIGHT );
engfunc( EngFunc_WriteCoord, flOrigin[ 0 ] );
engfunc( EngFunc_WriteCoord, flOrigin[ 1 ] );
engfunc( EngFunc_WriteCoord, flOrigin[ 2 ] );
write_byte( 30 );
write_byte( r );
write_byte( g );
write_byte( b );
write_byte( a );
write_byte( 40 );
message_end( );
}