benwilkins Posted June 14, 2013 Share Posted June 14, 2013 Hey, basically, I want to display the license plate above cars, as I have right now, it isnt above the car at all times. If I drive a little away from a car, the text goes way up high. I am wondering how I can scale it, so that the position is always locked right above the cars roof at whatever distance you are away from the car, and the further away from the car, the smaller it is? Thanks, much appreciated This is what I have so far. local px, py, pz = getElementPosition(localPlayer) -- vehicles for key, value in ipairs(getElementsByType("vehicle")) do if isElementStreamedIn(value) and (isElementOnScreen(value)) then local x, y, z = getElementPosition(value) local plateText = getVehiclePlateText ( value ) if (isLineOfSightClear(px, py, pz, x, y, z, true, false, false, true, false, false, true)) then local tx, ty = getScreenFromWorldPosition(x, y, z, 5000, false) if (tx) then local size = dxGetTextWidth(getVehicleName(value), 1, "bankgothic") + 170 dxDrawText(plateText, tx, ty, tx, ty-200, tocolor(10, 255, 10, 160), 0.6, "bankgothic", "center", "center") end end end end Link to comment
xXMADEXx Posted June 14, 2013 Share Posted June 14, 2013 This is what I use to set the scale: local scale = 2 local dist = getDistanceBetweenPoints3D ( px, py, pz, x, y, z ) scale = scale * ( ( 3- dist ) / 3) Link to comment
benwilkins Posted June 15, 2013 Author Share Posted June 15, 2013 I tried that, but it just makes them huge when you walk away http://puu.sh/3fHz4.jpg 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