Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. void PlayCarRadioOutside()
  2. {
  3. //Call CTimer, assign player to CPed, define variables to store the player's last used car and radio station
  4. CALLVOID(CTimer);
  5. CPlayer *player = (CPlayer *)PlayerPointer;
  6. CPed *ped = player->pPed;
  7. CVehicle *LastUsedCar;
  8. CAudio *radio = (CAudio *)CurrentRadio;
  9. //Check if player is in a Vehicle
  10. if (ped->m_bInVehicle == 1)
  11. {
  12. //Stop any music that is currently playing at the location of a Vehicle
  13. radio->UnloadAudioScriptObj();
  14. //Get current Vehicle then radio station and store it at CurrentRadio
  15. CVehicle *playerVehicle = *(CVehicle **)0x7E49C0;
  16. CurrentRadio = playerVehicle->m_nRadioStation;
  17. //Store current Vehicle at LastUsedCar
  18. LastUsedCar = playerVehicle;
  19. //Set HasBeenInVehicle to 1
  20. HasBeenInVehicle = 1;
  21. }
  22. //Check if player has got out of their current Vehicle
  23. if (ped->m_bInVehicle == 0 && HasBeenInVehicle == 1)
  24. {
  25. //Get current location of Vehicle
  26. float VehX = LastUsedCar->physical.matrix.posn.x;
  27. float VehY = LastUsedCar->physical.matrix.posn.y;
  28. float VehZ = LastUsedCar->physical.matrix.posn.z;
  29. //Play radio at last used Vehicle position
  30. radio->LoadAudioScriptObj();
  31. radio->SetAudioScriptObjLocation(VehX, VehY, VehZ);
  32. radio->PlayAudioScriptObj();
  33. //Set HasBeenInVehicle to 0
  34. HasBeenInVehicle = 0;
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement