SA-MP Forums Archive
Help for audio music - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help for audio music (/showthread.php?tid=400896)



Help for audio music - Witnec - 20.12.2012

Hi everyone,
I need some solutions to make all the passengers of a vehicle hear the same audiostream which the driver is listening to, Some solutions?


Re: Help for audio music - LarzI - 20.12.2012

By using a for loop
pawn Код:
for( new i = 0; i < MAX_PLAYERS; i ++ )
{
    if( GetPlayerVehicleID( i ) == GetPlayerVehicleID( playerid ))
    {
        //audiostream here
    }
}
or foreach
pawn Код:
foreach( new i : Player )
{
    if( GetPlayerVehicleID( i ) == GetPlayerVehicleID( playerid ))
    {
        //audiostream here
    }
}



Re : Help for audio music - Witnec - 21.12.2012

this will give the same for all the cars but i have already a radio system and every one can choose his radio, i want that just the driver can do that


Re: Re : Help for audio music - LarzI - 21.12.2012

Quote:
Originally Posted by Witnec
Посмотреть сообщение
this will give the same for all the cars
That really depends where you put this.

Quote:
Originally Posted by Witnec
Посмотреть сообщение
but i have already a radio system and every one can choose his radio, i want that just the driver can do that
Then simply do an if-statement with states
pawn Код:
if( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER )
{
    //disallow
}
else
{
    //allow
}