#1

i have script to switchnewsound in the car

PHP код:
forward SwitchNewSound();
public 
SwitchNewSound()
{
 for(new 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerInAnyVehicle(i))
        {
            
StopAudioStreamForPlayer(i);
            
PlayAudioStreamForPlayer(iRandomSongs[random(sizeof(RandomSongs))]);
            
URLNumber++;
            if(
URLNumber == sizeof(RandomSongs)) URLNumber 0;
        }
    }
    return 
1;

but how to stop when out of car any idea
Reply
#2

Quote:

StopAudioStreamForPlayer(id_here);

Note that the function you posted changes the audio for everyone in a vehicle.
Reply
#3

if(IsPlayerInAnyVehicle this code when player in veh and
Use
if(!IsPlayerInAnyVehicle( this ! Sign mean not
So add then code a d then add stopaudiostream
I hope u will understand
I'm using phone otherwise I give you code

If this work don,t forget to +rep
Reply
#4

If you mean you want to stop the sound when the player is leaving the vehicle,

Use this code. This callback will be called when the player leaves any vehicle he is in, and you can stop the audio for him.

https://sampwiki.blast.hk/wiki/StopAudioStreamForPlayer
https://sampwiki.blast.hk/wiki/OnPlayerStateChange

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
        // If the player exits a vehicle
	if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) 
	{
	    StopAudioStreamForPlayer(playerid); // Stop the audio stream
	}
	return 1;
}
Reply
#5

not work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)