Error in PlaySound on PlayerResquestClass

Started by Maximiliano, Dec 20, 2018, 10:10 PM

Previous topic - Next topic

Maximiliano

How could I make the sound stop?
[spoiler]
function onPlayerRequestClass( player, pclass, pteam, pskin )
{
Announce( "~t~" + GetNameClass( pteam ), player, 1 );
PlaySound( player.UniqueWorld , 50012 , player.Pos );
return 1;
}[/spoiler]
https://youtu.be/P72ACZWOy8k

Sebastian

It is not an error; Request Class is called everytime you change the class. (aka skin)
So:

when player dies, is sent to the Request Class.
You simply set an array which you update when he dies and when he spawns, like lob <- array( maxplayers, 0 )

when player dies you lob[ player.ID ] = 1
when joins the RequestClass, you if( job[ player.ID ] == 1 ) job[ player.ID ] = 2;
when player spawns, you lob[ player.ID ] = 0

Then you put the code you want, like this:
onPlayerRequestClass

if( job[ player.ID ] == 1 )
{
        job[ player.ID ] = 2;

       // your code below...
        player.PlaySound( rocky balboa sound id )
}

Maximiliano

Quote from: Sebastian on Dec 20, 2018, 10:36 PMIt is not an error; Request Class is called everytime you change the class. (aka skin)
So:

when player dies, is sent to the Request Class.
You simply set an array which you update when he dies and when he spawns, like lob <- array( maxplayers, 0 )

when player dies you lob[ player.ID ] = 1
when joins the RequestClass, you if( job[ player.ID ] == 1 ) job[ player.ID ] = 2;
when player spawns, you lob[ player.ID ] = 0

Then you put the code you want, like this:
onPlayerRequestClass

if( job[ player.ID ] == 1 )
{
        job[ player.ID ] = 2;

       // your code below...
        player.PlaySound( rocky balboa sound id )
}

Thanks, It served me :D