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.

[REQ] Some small help on Scripting

Featured Replies

Let me start by saying the only amount of scripting / coding I've done in my 18 years on this planet is simple HTML page design.

 

I've been looking into starting for IV (and possibly V in the future if we see a PC release) and I've decided on what should be a very simple script.

 

Main Idea: The script would essentially be an Automatic Number Plate Recognition system, or ANPR for short. I'm aware there has been one already made that has these functions but many people reported it to be unrealistic in the sense that it flagged too many vehicles and included emergency service vehicles. The script would scan a determined area in-front of and behind the player's vehicle to simulate ANPR cameras and then randomly determine if the vehicle should be flagged, with accompanying textdraws etc. If a flag is set, the reason will be displayed in a red text and an audible sound will be played, much like in real life. The sound could be changed by the player (like the ambient music script)

 

My experience: I've only started tonight, I've read through the topic at the gtaforums and whilst I understand most of the terminology, there is nothing to mention how to grab the details of a random AI vehicle (like the name) and apply a random variable from a pre-set list. I can understand this'll frustrate people but I'm asking for some simple help, I'm at the same situation I was back last year when I started using zModeler (which I now understand completely and how to get a vehicle working ingame) so it's just going to take a fair month or two.

 

I'd mainly need a list of native functions within IV that I can use, a complete list would be nice but the basic's to what I'm looking to create would be nice. If anyone has any information that could help me, I'd appreciate it greatly. After all, we all have to start somewhere right?

 

Thanks in advance, 

Harper

Processor: Intel i5-6600 @ 3.30GHz 

GPU: MSI ARMOR GeForce GTX 1080 OC

Ram: 16GB Skylake

I'd be glad to help. I wanted to include something like that into PoliceHelper, but I'm currently stuck with other features.

First of all do not use native functions unless it is necessary and they don't have equivalent in SHDN.

 

Grab documentation from HazardX's site, it is in windows help format, so it won;t work out of the box in Win7 but you'll find somewhere how to run such files.

 

To keep data for specific vehicle you should build class for it. Also we both could use metadata to communicate between PoliceHelper and your script to give the same data to user. I heard that metadata are slow , but from my experience if you don't try to read/write from/to them in tight loop the will work just fine.

 

  • Author

I'd be glad to help. I wanted to include something like that into PoliceHelper, but I'm currently stuck with other features.

First of all do not use native functions unless it is necessary and they don't have equivalent in SHDN.

 

Grab documentation from HazardX's site, it is in windows help format, so it won;t work out of the box in Win7 but you'll find somewhere how to run such files.

 

To keep data for specific vehicle you should build class for it. Also we both could use metadata to communicate between PoliceHelper and your script to give the same data to user. I heard that metadata are slow , but from my experience if you don't try to read/write from/to them in tight loop the will work just fine.

 

Awesome thanks.

 

I've already for the documentation working on windows 7, currently having a read through it. As for the class files, the forum did touch upon them slightly but I'll have to look deeper into making them store data for each car model (possibly variants too like an admiral can be stolen or have no insurance etc.).

 

Soon as I get a foothold on this, I'll look into metadata and such

 

By looking at the test scripts included, I've located some functions that could possibly be used in an ANPR script:

SelectedCar = World.GetClosestVehicle(Player.Character.Position, 5.0F);
                     if (!Exists(SelectedCar)) return;

Am I correct in thinking this?

Processor: Intel i5-6600 @ 3.30GHz 

GPU: MSI ARMOR GeForce GTX 1080 OC

Ram: 16GB Skylake

Close. Problem with "closest vehicle" is that it will probably return players vehicle. Here you should go through World.GetVehicles(radius) and exclude police cars, players car etc, and check which car is the closest one and if it is in front of the player.

I use GetClosestVehicle in my script but rather than use Player.Character.Position I use an offset of the current position i.e. (Player.Character.CurrentVehicle.GetOffsetPosition(offset)) which lets me set how far away the "detection zone" is, however this method is really simple and only tracks what's in front/back of the player at a given time, so slightly useless for keeping any "history" of pings of any sort.

 

 

Frankly I kept it that simple because I'm quite lazy at times and absolutely hate keeping lists of any sort  :whistling: 

  • Author

Alright guys, I appreciate your help so far. I'm beginning to understand this.

 

Thing is, the topic on gta forums is clustered and only gives a structure for a script that'll spawn you a vehicle or whatever, I may need more help than I thought with structuring the script and also creating the classes for each vehicle.

Processor: Intel i5-6600 @ 3.30GHz 

GPU: MSI ARMOR GeForce GTX 1080 OC

Ram: 16GB Skylake

I use GetClosestVehicle in my script but rather than use Player.Character.Position I use an offset of the current position i.e. (Player.Character.CurrentVehicle.GetOffsetPosition(offset)) which lets me set how far away the "detection zone" is, however this method is really simple and only tracks what's in front/back of the player at a given time, so slightly useless for keeping any "history" of pings of any sort.

 

 

Frankly I kept it that simple because I'm quite lazy at times and absolutely hate keeping lists of any sort  :whistling: 

 

I've have gotten use to the car reseting after looking away and back.   I dont suppose it is easy to script or work around since no one else has done it?

I have got a quick question and I do apologize if you see this as hijacking this thread. Scripting uses what kind of programs to work for IV?? And class files are need right??

6SF09cc.jpg
JetPhotos.Net        Airliners.Net        Radar Photography         Twitter

 

I've have gotten use to the car reseting after looking away and back.   I dont suppose it is easy to script or work around since no one else has done it?

 

It's not difficult per se and can definitely be done, but it can be a real time-consuming process to get it right.  I personally don't like working with lists with GTA because with objects regularly coming and going out of memory there's too much potential for conflicts that can take forever to iron out.

Checking if object still exists it's ultra fast. I do it VERY often and it doesn't slow down whole loops. I've made some speed test before and was very surprised how fast all things are done. For example generating ID for ped is very complicated and depends on huge lists, sometimes containing over 500 entries (names, surnames, etc). It takes 0,2-0,4 second which is very very slow, but it is like that only for the first time as script has to load huge arrays. Then generating id for next ped takes... 0,001 - 0,002 s which is very fast. You have to know that in this script it checks ethnicity based on big arrays, generates random warrant, checks age based on arrays an many many more, but it's still fast.

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.