callum123 Posted November 18, 2012 Posted November 18, 2012 How do I get the vehicle from the number plate? Is it possible? I want to add a blip to the vehicle without anyone inside it. I want to get hold of the vehicle from the number plate....
Castillo Posted November 18, 2012 Posted November 18, 2012 function getVehicleByPlate ( plate ) local found = false for _, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do if ( getVehiclePlateText ( vehicle ) == plate ) then found = vehicle break end end return found end San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
callum123 Posted November 18, 2012 Author Posted November 18, 2012 Tried doing this with no luck. Is there some minor tweaks needed? function getVehicleByPlate ( logInDetails ) for _, vehicle in ipairs (getElementsByType ("vehicle")) do if getVehiclePlateText ( vehicle ) == logInDetails then found = vehicle local x, y, z = getElementPosition(source) local vx, vy, vz = getElementPosition(found) if getDistanceBetweenPoints2D(x, y, vx, vy) < 420 then createBlipAttachedTo(found, 0, 4, 255, 0, 0, 255, 0, 100, source) outputChatBox("Plate registered and found, destination marked on GPS", 255, 0, 0, true) end break end return found end end
Castillo Posted November 18, 2012 Posted November 18, 2012 Any errors on debugscript? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
callum123 Posted November 18, 2012 Author Posted November 18, 2012 No errors no, even if I do if getVehiclePlateText ( vehicle ) == "Hello123" then And I know there is a vehicle with that plate, it seems not to enter the if statement.
Castillo Posted November 18, 2012 Posted November 18, 2012 Try looping all vehicles and get their plate text. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
callum123 Posted November 18, 2012 Author Posted November 18, 2012 Like this will not even display the debug string. logInDetails1 = "Hello123" for _, vehicle in ipairs (getElementsByType ("vehicle")) do if getVehiclePlateText ( vehicle ) == tostring(logInDetails1) then outputDebugString("Test") Is https://wiki.multitheftauto.com/wiki/GetVehiclePlateText a server function? In the list it is not displayed yet on the actual page it is displayed...?
Castillo Posted November 18, 2012 Posted November 18, 2012 I did a simple test, created random vehicle get the plate text, and returns wrong one. I guess this function doesn't work so good. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now