itsMatheus Posted December 30, 2017 Share Posted December 30, 2017 Is it possible to get a vehicle by its license plate? Like do a command /platecheck [licenseplate] and then return all the information about the vehicle. I'm trying to figure out a way to do it but I can't find a solution. Keep in mind that I am new at scripting, so sorry if this is a easy thing to do. Link to comment
Dimos7 Posted December 30, 2017 Share Posted December 30, 2017 if you have a database and you have store the plate of the vehicle with the name etc yes 1 1 Link to comment
Slim Posted December 30, 2017 Share Posted December 30, 2017 ^ What he said, you need an accounts database it sounds like. Check MTA resources Also, you can retrieve vehicle variants or components even though there's not much you could do with these it's an example.https://wiki.multitheftauto.com/wiki/Vehicle_variantshttps://wiki.multitheftauto.com/wiki/Vehicle_Components 1 Link to comment
koragg Posted December 30, 2017 Share Posted December 30, 2017 Maybe you can use this: https://wiki.multitheftauto.com/wiki/GetVehiclePlateText and if a vehicle with the plate you write is found, show all of the things of that vehicle (idk what you want to show). So something like: function checkPlate(player, command, text) for k, v in ipairs(getElementsByType("vehicle")) do if string.lower(getVehiclePlateText(v)) == string.lower(text) then outputChatBox("Yey, it worked! Let's output some :~", player, 255, 255, 255, true) else outputChatBox("fml.", player, 255, 255, 255, true) end end end addCommandHandler("checkplate", checkPlate) Obviously not tested 1 Link to comment
itsMatheus Posted December 30, 2017 Author Share Posted December 30, 2017 @koragg It works! Thank you so much guys for all the replies. I think it's easier to use the last alternative than to make a whole database just for it. Link to comment
koragg Posted December 30, 2017 Share Posted December 30, 2017 (edited) You're welcome I like simple things too, if it can be done simple - that's the best way Edited December 30, 2017 by koragg Link to comment
ShayF2 Posted December 30, 2017 Share Posted December 30, 2017 (edited) function getVehicleFromPlate(text) local vehicles = getElementsByType('vehicle') for i=1,#vehicles do if string.lower(getVehiclePlateText(vehicles[i])) == string.lower(text) then return vehicles[i] end end return false end Edited December 30, 2017 by ShayF 1 1 Link to comment
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