AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] Emit sound loop (https://forums.alliedmods.net/showthread.php?t=335479)

Barlap 12-08-2021 14:22

[Help] Emit sound loop
 
Hello, can somebody help me with a code piece for this plugin.
I want to make the xmas tree emit music non stop but the music stops when u join any team
Here is the code:
Code:

#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

new const MODEL[ ] = "models/icero_events/xmas/ice_tree.mdl";
new const SONG[ ] = "icero_events/tree_xmas.wav";

#define AMBIENT_SOUND_LARGERADIUS 8

public plugin_precache( ) {       
        precache_model( MODEL );
        precache_sound( SONG );
}

public plugin_init( ) {
        register_plugin( "Xmas Tree", "Deathrun", "xPaw" );
       
        new iSpawn = engfunc( EngFunc_FindEntityByString, FM_NULLENT, "classname", "info_player_start" );
       
        if( !iSpawn ) return;
       
        new iEntity = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "ambient_generic" ) );
       
        set_pev( iEntity, pev_message, SONG );
        set_pev( iEntity, pev_spawnflags, AMBIENT_SOUND_LARGERADIUS );
        set_pev( iEntity, pev_effects, EF_BRIGHTFIELD );
       
        new Float:vOrigin[ 3 ];
        pev( iSpawn, pev_origin, vOrigin );
        set_pev( iEntity, pev_origin, vOrigin );
        set_pev( iEntity, pev_health, 10.0 );
       
        ExecuteHam( Ham_Spawn, iEntity );
        engfunc( EngFunc_SetModel, iEntity, MODEL );
        engfunc( EngFunc_DropToFloor, iEntity );
}


DJEarthQuake 12-09-2021 07:05

Re: [Help] Emit sound loop
 
Have you tried spawning tree on new round instead of plugin_init?


All times are GMT -4. The time now is 11:30.

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