How can I display the license plate of the car in front of me on my HUD?
-
Hey guys,
I want to display the license plate on my screen of the car in front of me.
I want to do this, because when I play LSPDFR, I can't really see the license plates of the cars I pull over until I get out of the car and get really close to it. I'd like to make it so while I got a car pulled over, the license plate of that car shows up on my HUD so I can see it without getting out of my car.
I haven't found a public mod like this anywhere so I'd like to make it myself. Where can I start looking on how to do this?
-
@Gosuphobia This would need to be a script that gets a reference to the nearest vehicle with
GET_CLOSEST_VEHICLE
(or the one you're aiming atGET_ENTITY_PLAYER_IS_FREE_AIMING_AT
) and then uses theGET_VEHICLE_NUMBER_PLATE_TEXT
native on it to get the license plate. You'd then have some UI function to render it on the screen. You could just output it as plain text or if you want to get fancy, draw a bitmap on the screen of the license plate background and print some stylized text on top of it.
-
Would this script have to be in .net or LUA?
-
@Gosuphobia Either is fine
-
@rappo
A raycast or a searching area would be more effective, since other cars can pass by, or the user wouldn't need to constantly aimI made a few samples:
Search all vehicles, then filter
Pros:
- Good adaptable searching area
- Height-independent
Cons:
- Needs to iterate through all vehicles in all world vehicles
Raycast
Pros:
- No need to search through all vehicles
Cons:
- Very narrow (line) searching area
- Height plays a role
- Raycast could be distance-limited?
Not sure if there's a native that just returns all close-by vehicles, which could aid the searching method.