Quote:
Originally Posted by BenzoAMG
Example:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER) { if(oldstate == PLAYER_STATE_ONFOOT) { for(new i = 0; i < MAX_PLAYERS; i++) //foreach is an alternatively better method { if(IsPlayerConnected(i)) { if(IsPlayerInVehicle(i, GetPlayerVehicleID(playerid))) { PlayRadioStationForPlayer(i); } } } } } if(newstate == PLAYER_STATE_ONFOOT && (oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)) { StopAudioStreamForPlayer(playerid); } return 1; }
Only thing that concerns me is that the radio may not stop for everyone in the car when the driver exits the vehicle.
|
I would want only the stream to stop for an individual when they step out the vehicle.