04.04.2011, 06:23
I created a radio system for my vehicle system and im having problems with player states
this script actives the radio and disables when a player state onfoot, passenger and driver changes... i tryed use onplayerentervehicle but if a player enters and stops from enter it will bug up so im using player states but here is the bug when the player exits the car and enters the music does not display at second time any idea what im doing wrong?
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if( newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER )
{
new vehicleid = GetPlayerVehicleID( playerid );
oldcar[playerid] = vehicleid;
if(listningmusic[playerid] == 0)
{
if(VehicleRadioStatus[vehicleid] == 1)
{
Audio_PlayStreamed(playerid,radiostation[vehicleid] );
SendClientMessage(playerid, GRAY, "Hint: the music on this car is on");
listningmusic[playerid] = 1;
}
}
}
else if( newstate == PLAYER_STATE_ONFOOT )
{
if(listningmusic[playerid] == 1)
{
Audio_Pause(playerid,currentradio[oldcar[playerid]]);
listningmusic[playerid] = 0;
}
}
return 1;
}