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.

[Request] API Additions

Featured Replies

LSPDFR 0.4 introduced an incredible set of features regarding customizeability with the data folder. To completely integrate such features third-party modifications without having modders create their own interpreter for LSPDFR's data files I suggest the following API additions:

 

Vehicle RequestBackup(Vector3 position, EBackupResponseType responseType, EBackupUnitType backupUnitType, string agencyScriptName, string flag);
Vehicle RequestBackup(Vector3 position, EBackupResponseType responseType, EBackupUnitType backupUnitType, string agencyScriptName, bool exactLocation, bool noResponseTask, string flag);
Vehicle RequestBackup(Vector3 position, EBackupResponseType responseType, EBackupUnitType backupUnitType, string flag);
Vehicle RequestBackup(Vector3 position, EBackupResponseType responseType, EBackupUnitType backupUnitType, string agencyScriptName, bool exactLocation, bool noResponseTask, int? occupants, string flag);

Implement another fuction argument "flag" (or possibly a function overload) that allows the use of either the default LSPDFR flags, or of custom flags added onto the XML. In case there is no vehicle with that flag, return as if the flag was not an argument. Would allow for usage of LSPDFR's own system for managing extra units instead on relying on each plugin implementing their own system to get units customized for a given necessity.

 

Ped CreateMPPed(bool isMale, Vector3 position, float heading);
Ped CreateMPPed(bool isMale, Vector3 position);

Implement a function to utilize LSPDFR's built-in ability to spawn a randomized mp_m/f_freemode_01 ped with distinct facial/hair features. Would allow the use of semi-random characters in callouts instead of built-in peds.

 

void ReleasePed(Ped ped);

Implement a function allowing plugins to release an arrested Ped.

Apart from these requests regarding the API, I'd also love to see a way to disable LSPDFR's control of the sirens with possibly something like:

Main.DisableSirenControl=false

 

Edited by TheMaybeast

  • Management Team

Please see my comments in Italic.

 

On 10/3/2020 at 1:41 AM, TheMaybeast said:

Implement another fuction argument "flag" (or possibly a function overload) that allows the use of either the default LSPDFR flags, or of custom flags added onto the XML. In case there is no vehicle with that flag, return as if the flag was not an argument.

 

This is my only concern, as I could imagine both cases being interesting. Sometimes you want exactly that model, sometimes you would like a fallback. So maybe another parameter to specify whether the flags must match? Also I think we would need to be able to pass multiple flags at once, what do you think of a comma separated string?  I would probably also only add that parameters to the function with all parameters to avoid bloating the "smaller" overloads.
 


Ped CreateMPPed(bool isMale, Vector3 position, float heading);
Ped CreateMPPed(bool isMale, Vector3 position);

Implement a function to utilize LSPDFR's built-in ability to spawn a randomized mp_m/f_freemode_01 ped with distinct facial/hair features. Would allow the use of semi-random characters in callouts instead of built-in peds.

 

To avoid having to maintain ped creation and parameters for it, perhaps just a function to randomize MP appearance. What do you think? That way ped spawning is still very much up to the developer.


void ReleasePed(Ped ped);

Implement a function allowing plugins to release an arrested Ped.

 

No objections.

Apart from these requests regarding the API, I'd also love to see a way to disable LSPDFR's control of the sirens with possibly something like:


Main.DisableSirenControl=false

What siren control feature are you referring to specifically?

 

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

  • Author
Quote

This is my only concern, as I could imagine both cases being interesting. Sometimes you want exactly that model, sometimes you would like a fallback. So maybe another parameter to specify whether the flags must match? Also I think we would need to be able to pass multiple flags at once, what do you think of a comma separated string?  I would probably also only add that parameters to the function with all parameters to avoid bloating the "smaller" overloads.


An alternative to adding those parameters and possibly bloating the RequestBackup API function might be adding something like:
 

Vehicle RequestBackupWithFlag(Vector3 position, EBackupResponseType responseType, EBackupUnitType backupUnitType, string agencyScriptName, string flags, bool hasFallback = true);
Vehicle RequestBackupWithFlag(Vector3 position, EBackupResponseType responseType, EBackupUnitType backupUnitType, string agencyScriptName, bool exactLocation, bool noResponseTask, string flags, bool hasFallback = true);
Vehicle RequestBackupWithFlag(Vector3 position, EBackupResponseType responseType, EBackupUnitType backupUnitType, string flags, bool hasFallback = true);
Vehicle RequestBackupWithFlag(Vector3 position, EBackupResponseType responseType, EBackupUnitType backupUnitType, string agencyScriptName, bool exactLocation, bool noResponseTask, int? occupants, string flags, bool hasFallback = true);

The flags being separated by a comma in the "flags" string and including the "hasFallback" boolean parameter to decide if a fallback model is sent or null.

 

Quote

To avoid having to maintain ped creation and parameters for it, perhaps just a function to randomize MP appearance. What do you think? That way ped spawning is still very much up to the developer.


That seems in fact a good idea.
 

void RandomizeMPPed(Ped ped)

Internally, figures out if male/female MP Ped. Or if you believe it's a smarter idea to add something like a boolean "isMale" parameter it also would maintain the same core idea.

 

Quote

What siren control feature are you referring to specifically?


Every way LSPDFR deals with lights/sirens for the player vehicle. Including the J key to toggle siren sounds on/off and it toggling on automatically post-traffic stops.

36 minutes ago, TheMaybeast said:

That seems in fact a good idea.


void RandomizeMPPed(Ped ped)

Internally, figures out if male/female MP Ped. Or if you believe it's a smarter idea to add something like a boolean "isMale" parameter it also would maintain the same core idea.

 

This is basically what we do already, yeah.  Just one extension method with an automatic model hash check.  We actually have quite a few other things there related to those peds as well like a method to remove clothes (for the shower) and then quite a few that query the shop.ymt data to do things like check if a female ped is wearing heels or to correctly apply hair styles (including the special underlay textures that each style has) among other things.

"You tell me exactly what you want, and I will very carefully explain to you why it cannot be."

  • Author

Since this is already an open discussion I'll append here a few other QoL additions to the API that would be extremely useful:

// Makes ped provide ID to the player like on the stop menu (w/o dispatch information as warrants/license validity).
void DisplayPedId(Ped ped);

// Rename existing DisplayPedId to DisplayRecordsCheck to avoid confusion.
void DisplayPedId(Ped ped, bool noDelay) = void DisplayRecordsCheck(Ped ped, bool noDelay);

// Makes ped frisk ped.
void StartPedFrisk(Ped cop, Ped suspect, bool force);
// Gets called when a ped gets frisked.
Event OnPedFrisked;

// Gets called when a ped gets dismissed from a stop.
Event OnPedReleasedFromStop;

// More options for vehicle/ped spawning, w/o actually acting like backup units (Perfect for creating units already on scene for callouts)
Vehicle GetEmergencyVehicle(Vector3 position, EBackupUnitType backupUnitType, string agencyScriptName);
Vehicle GetEmergencyVehicleWithFlag(Vector3 position, EBackupUnitType backupUnitType, string agencyScriptName, string flag, bool hasFallback);

// Implement search/contraband to Vehicle.
// More complex, would require some sort of vehicle inventory system.
void AddVehicleContraband(Vehicle vehicle, ContrabandType contrabandType, string name);
void ClearVehicleContraband(Vehicle vehicle);
List<VehicleContraband> GetVehicleContraband(Vehicle vehicle);
bool IsVehicleCarryingContraband(Vehicle vehicle);
void RemoveVehicleContraband(Vehicle vehicle, VehicleContraband contraband);
// Makes ped search vehicle.
void StartVehicleSearch(Ped cop, Vehicle vehicle, bool force);
// Gets called when a vehicle gets searched.
Event OnVehicleSearched;

@LMS

Edited by TheMaybeast

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.