Sticmy Posted May 5, 2017 Posted May 5, 2017 Hola chicos del MTA! Tengo un problema que no tengo idea de como resolverlo.. Lo que pasa es que quisiera que quede así la Rectangle PD: Lo hice con el guieditor para hacerme explicar Pero cuando pongo el Rectangle se pone así cuando muevo cámara se pone así también Alguna manera de arreglarlo dejo la función aquí mismo! addEventHandler("onClientRender", root, function() for k, v in ipairs(getElementsByType("ped")) do local x, y, z = getElementPosition(localPlayer) local x2, y2, z2 = getElementPosition(v) local a, b = 100, 100 local cx, cy, cz = getCameraMatrix() if getDistanceBetweenPoints3D(x, y, z, x2, y2, z2 + 0.5) < 7 and isLineOfSightClear(cx, cy, cz, x2, y2, z2 + 0.5, true, true, false) then local sx, sy = getScreenFromWorldPosition(x2, y2, z2 + 0.5) if sx and sy then sx, sy = sx - a, sy - b dxDrawRectangle(sx - 10, sy, sx + 20, sy + 20, tocolor(0, 0, 0, 100)) dxDrawText("Salud: ".. math.ceil(getElementHealth(v)).."", sx - 10, sy, sx + 500, sy + 500, tocolor(0, 255, 0, 100), 1.2, "default-bold") end end end end ) Por favor necesito ayuda es para mi Roleplay My name in the game is: Sticmy My discord: Sticmy#3817 My discord community: https://discord.gg/366Y9bB
DBY Posted May 5, 2017 Posted May 5, 2017 Estás sumando la posición x al width y la y al height, ¿con qué propósito haces esto? Ese es el fallo. YT Channel
Sticmy Posted May 5, 2017 Author Posted May 5, 2017 Por más que lo ponga derecho el problema sigue al mover la cámara se ancha más y baja más... My name in the game is: Sticmy My discord: Sticmy#3817 My discord community: https://discord.gg/366Y9bB
DBY Posted May 5, 2017 Posted May 5, 2017 (edited) 21 minutes ago, MarkFlash said: Por más que lo ponga derecho el problema sigue al mover la cámara se ancha más y baja más... Ya te he dicho por qué sucede esto, lee mi primer comentario y razona. Edited May 5, 2017 by danibayez YT Channel
Sticmy Posted May 5, 2017 Author Posted May 5, 2017 No hay ningún fallo man Prueba el código en tu local y verás.. My name in the game is: Sticmy My discord: Sticmy#3817 My discord community: https://discord.gg/366Y9bB
DBY Posted May 5, 2017 Posted May 5, 2017 El fallo es que estás sumando al ancho y al alto del rectángulo la posición obtenida con getScreenFromWorldPosition. ¿Lo entiendes ahora? YT Channel
Sticmy Posted May 6, 2017 Author Posted May 6, 2017 6 hours ago, danibayez said: El fallo es que estás sumando al ancho y al alto del rectángulo la posición obtenida con getScreenFromWorldPosition. ¿Lo entiendes ahora? Ah ya entendí, veré si funciona My name in the game is: Sticmy My discord: Sticmy#3817 My discord community: https://discord.gg/366Y9bB
Sticmy Posted May 6, 2017 Author Posted May 6, 2017 El error sigue por favor ayúdenme My name in the game is: Sticmy My discord: Sticmy#3817 My discord community: https://discord.gg/366Y9bB
DBY Posted May 7, 2017 Posted May 7, 2017 Cambia la línea 12. dxDrawRectangle( sx - 10, sy, 20, 20, tocolor( 0, 0, 0, 100 ) ) A ver si así lo llegas a entender. YT Channel
Sticmy Posted May 10, 2017 Author Posted May 10, 2017 On 2017-5-7 at 05:07, danibayez said: Cambia la línea 12. dxDrawRectangle( sx - 10, sy, 20, 20, tocolor( 0, 0, 0, 100 ) ) A ver si así lo llegas a entender. man he hecho lo que me dices pero sigue.. My name in the game is: Sticmy My discord: Sticmy#3817 My discord community: https://discord.gg/366Y9bB
DBY Posted May 10, 2017 Posted May 10, 2017 Sería más fácil si postearas el código cada vez que lo edites. YT Channel
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