Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

On-BeforeFunction Function Question

Featured Replies

Hey all.

Love the great work contributed by so many. Just hoping for some guidance.

I am making a script to play an audio file of mine before the audio file requested by any given callout script would play.

I need help though. Is there any function that would help me do this? I'm thinking something on the lines of 'OnBeforeFunction'.

My guess as to how it would appear:

OnBeforeCalloutDisplayed() 
 - check if callout is in my list of what would be an emergency dispatch transmission.

OnBeforePlayScannerAudioUsingPosition
 - PlayScannerAudio("MY FILE THAT I PUT THE ALARM IN")

My vision is that when we have a callout like an officer shot, the dispatcher makes an emergency transmission on the radio. It would be an alarm tone followed by the dispatcher advising all units to respond immediately. 

Initially, I thought to edit the relevant audio files, however the range and shared use of audio files makes this not possible.

I am new to GTA V scripts, and to what LSPDFR has to offer in functionality, but I am appreciative of any help.

 

Cheers!

Edited by Kraezd

Is this an issue solely with the Officer Shot callout, or is this for your own script?

As for playing the audio - I don't see why you couldn't play the scanner during OnBeforeCalloutsDisplayed().  I haven't tried that before though!

 

 

9 hours ago, Kraezd said:

Hey all.

Love the great work contributed by so many. Just hoping for some guidance.

I am making a script to play an audio file of mine before the audio file requested by any given callout script would play.

I need help though. Is there any function that would help me do this? I'm thinking something on the lines of 'OnBeforeFunction'.


My guess as to how it would appear:

OnBeforeCalloutDisplayed() 
 - check if callout is in my list of what would be an emergency dispatch transmission.

OnBeforePlayScannerAudioUsingPosition
 - PlayScannerAudio("MY FILE THAT I PUT THE ALARM IN")

My vision is that when we have a callout like an officer shot, the dispatcher makes an emergency transmission on the radio. It would be an alarm tone followed by the dispatcher advising all units to respond immediately. 

Initially, I thought to edit the relevant audio files, however the range and shared use of audio files makes this not possible.

I am new to GTA V scripts, and to what LSPDFR has to offer in functionality, but I am appreciative of any help.

 

Cheers!

I don't really see the problem?  You can just add a Functions.PlayScannerAudio(youraudiofile) in the OnBeforeCalloutDisplayed override. 

My YouTube: Click here. 

My Discord Server - https://discord.gg/0taiZvBSiw5qGAXU

Useful post? Let me and others know by clicking the Like button.
Check out my many script modifications! 
Having issues? LSPDFR Troubleshooter by Albo1125.

  • Author

Thanks for the quick replies.

I will give it a shot with BeforeCalloutDisplayed and post an update...

I was just not sure if it would have a conflict playing audio (either overlapping with the callout audio or a delay) and it seemed more logical to call a function on the trigger of 'before the dispatch audio plays' as opposed to 'before you display the callout' but I will let you know!

Thanks @fiskey111 & @Albo1125

The scanner only plays the first audio it gets to, unless it's finished by the time the next audio is set to play.  For instance, if you had this:

Functions.PlayScannerAudioUsingPosition("STUFF");
///

SOME

CODE

///

Functions.PlayScannerAudioUsingPosition("NEXT STUFF");

If the /// SOME CODE // doesn't take the length of time that "STUFF" would take (let's say 10 seconds) to play then the "NEXT STUFF" wouldn't play.  However, if the first takes enough time (as in the /// SOME CODE /// takes 15 seconds to run, 5 seconds over the length of "STUFF") then the second will play.

 

 

Is there a way to tell when the scanner audiois done playing, like how you can wait until a task is finished? If not, that should be added to the API. 

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

3 minutes ago, PNWParksFan said:

Is there a way to tell when the scanner audiois done playing, like how you can wait until a task is finished? If not, that should be added to the API. 

Personally I just time the audio myself using all the pieces and make a new GameFiber that sleeps for that amount of time.  It's a bit annoying to do, but if you need to do that then that's the only option I know of (until it's added to the API)!

 

 

3 minutes ago, fiskey111 said:

Personally I just time the audio myself using all the pieces and make a new GameFiber that sleeps for that amount of time.  It's a bit annoying to do, but if you need to do that then that's the only option I know of (until it's added to the API)!

It would be nice if the play scanner function took a bool for whether to play it after the current audio is done. And if it had a wait until finished method. 

@LMS any chance this could be implemented in the next API update?

Edited by PNWParksFan

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.