Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void PlayCarRadioOutside()
- {
- //Call CTimer, assign player to CPed, define variables to store the player's last used car and radio station
- CALLVOID(CTimer);
- CPlayer *player = (CPlayer *)PlayerPointer;
- CPed *ped = player->pPed;
- CVehicle *LastUsedCar;
- CAudio *radio = (CAudio *)CurrentRadio;
- //Check if player is in a Vehicle
- if (ped->m_bInVehicle == 1)
- {
- //Stop any music that is currently playing at the location of a Vehicle
- radio->UnloadAudioScriptObj();
- //Get current Vehicle then radio station and store it at CurrentRadio
- CVehicle *playerVehicle = *(CVehicle **)0x7E49C0;
- CurrentRadio = playerVehicle->m_nRadioStation;
- //Store current Vehicle at LastUsedCar
- LastUsedCar = playerVehicle;
- //Set HasBeenInVehicle to 1
- HasBeenInVehicle = 1;
- }
- //Check if player has got out of their current Vehicle
- if (ped->m_bInVehicle == 0 && HasBeenInVehicle == 1)
- {
- //Get current location of Vehicle
- float VehX = LastUsedCar->physical.matrix.posn.x;
- float VehY = LastUsedCar->physical.matrix.posn.y;
- float VehZ = LastUsedCar->physical.matrix.posn.z;
- //Play radio at last used Vehicle position
- radio->LoadAudioScriptObj();
- radio->SetAudioScriptObjLocation(VehX, VehY, VehZ);
- radio->PlayAudioScriptObj();
- //Set HasBeenInVehicle to 0
- HasBeenInVehicle = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement