[HELP] Car spawn with specific license plate

roleplay
help
scripting
scripts

#1

So, I’m using VRP framework but people don’t like how they need to go to a marker to buy a car. So I thought I’d implement it into the f9 menu. But that went horribly wrong and I almost committed suicide because I broke it all.
The only +side of the garage system, is that it makes the car spawn with the users registration number from the sql database.
So I thought I’d edit mello trainer so that when the vehicle spawns, it spawns with the registration number.
In the garage script I found this

SetVehicleNumberPlateText(nveh, "P "…tvRP.getRegistrationNumber())

if I put

SetVehicleNumberPlateText(nveh, “TEST”)

It makes the license plate test
but

SetVehicleNumberPlateText(nveh, "P "…tvRP.getRegistrationNumber())

doesn’t work on the trainer, only the garage system.
Any ideas??
I’m really struggling on this one


#2

try making a local “plate” for example and make it = tvRP.getRegistrationNumber instead of putting that whole API between the parenthesis. So like

local plate = tvRP.getRegistrationNumber()

then

SetVehicleNumberPlateText(nveh, "P "…plate)

May not be correct cause im still noob in lua with FiveM but something like that.


#3

I don’t think if that would work, thanks for the help tho, I think I may know the problem but don’t know how to fix it. In the VRP mod, somewhere else it probably has database connection info. I found where the getregistration number is defined. It just looked for registration number In database where it matches the user id and returns it, but I have no idea how to make it read an sql database in lua…only html. I guess the only other thing I could do is implement the buy garage system shit into a menu but I am clueless with lua. Wish they chose c++ or something. It must be so simple I just cannot read lua. This is so frustrating
With the garage system it looks like this.
and I want it to look like this with mello trainer


#4

Bump
I still really need help


#5

@callmejaf

Search where your car ist spawned and enter this

SetVehicleNumberPlateText(vehicle,“TEST 12”)

with

SetVehicleCustomPrimaryColour(vehicle, 0, 230, 230)

you can change the Vehicle color exaple cyan

if you inster this

local plate = math.random(100, 900)
SetVehicleNumberPlateText(vehicle,"ART “…plate…” ")

you will get a rnd plate like “ART 123”

've fun