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.

List of possible Vehicles

Featured Replies

I was wondering, does anyone know how to make an array of random vehicles that could spawn instead of just spawning one type... for example:

myVehicle = new Vehicle("felon", SpawnPoint);
  • Is there a way to make a list or array?
  • and can it be random per callout?

I Uploaded my c# file so you could take a look:smile:

MainCallouts.cs

Main.cs

HOOYAAA

Yup. We had a post on this, but I think it was cleaned out from the Example API thread. (Luke or any other Moderator, if those posts are archived somewhere, can we get them restored here in their own thread?)

Here is a basic example.

private String[] vehModels = {"Felon", "Ingot", "Premier", "Stanier"};

Random myRand = new Random();

// Random.Next(x) gets a random integer between zero and (x - 1)...meaning, 0 being the lower bound and the parameter (in this case, x) being the (exclusive, not inclusive) higher bound

// Random.Next(x, y) would get a random integer between x and (y - 1)...meaning, x being the (inclusive) lower bound, and y being the (exclusive) higher bound

// So, we're getting a random number between 0 and 3, and using that number to get a random item from the array
String myModel = vehModels[myRand.Next(vehModels.Length)];

Vehicle myVeh = new Vehicle(myModel, SpawnPoint);

You can do the same thing with Ped models too.

Edited by Stealth22

Stealth22
LSPDFR Tester | Plugin Developer
My Plugins: Code 3 Callouts | Traffic Control | Keep Calm | ALPR+

Please do not PM me for any kind of technical support.
I unfortunately do not have enough free time to answer every PM that I get. For issues with my plugins, please post in the comments section of the file, or it's forum thread. You'll get a much quicker response from me there than if you send me a PM; I do my best to respond to every question in the comments sections. For API/programming questions, please post them in the API Development forum, so all developers can benefit from the answer as well. Thanks!

I haven't tested if it works or not, but for vehicles, you can do 'Model.RandomVehicleModel'. Though Stealth's solution above gives you more control over what can actually spawn.

  • 6 years later...
On 7/28/2015 at 2:57 PM, FtDLulz said:

I haven't tested if it works or not, but for vehicles, you can do 'Model.RandomVehicleModel'. Though Stealth's solution above gives you more control over what can actually spawn.

This does work, but it could even spawn a helicopter LOL

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.