MAB Posted July 11, 2015 Share Posted July 11, 2015 Hi i need your help with a dx drawing functions... i am making a dx speedometer but this my first time to deal with dx and gui stuff so i looked to the drawing functions i didn't find anything in the rectangle that makes my able to write in that rectangle dxDrawText...do u use that to write on the rectangle? what about progress bars? how u make them inside the rectangle?? I NEED AN EXAMPLE NOT TO TELL ME WHAT FUNCTION TO USE also the rectangles ain't getting destroyed when the player leaves the vehicle code: function draw () nitro = dxDrawRectangle(929, 619, 170, 33, tocolor(57, 59, 50, 100), false) fuel = dxDrawRectangle(929, 576, 170, 33, tocolor(57, 59, 50, 100), false) speed = dxDrawRectangle(929, 533, 170, 33, tocolor(57, 59, 50, 100), false) lock = dxDrawRectangle(929, 490, 170, 33, tocolor(57, 59, 50, 100), false) engine = dxDrawRectangle(929, 447, 170, 33, tocolor(57, 59, 50, 100), false) light = dxDrawRectangle(929, 404, 170, 33, tocolor(57, 59, 50, 100), false) end function event () addEventHandler("onClientRender", root, draw) end addEventHandler("onClientPlayerVehicleEnter",getRootElement(),event) function destroy () destroyElement(nitro) destroyElement(fuel) destroyElement(speed) destroyElement(lock) destroyElement(engine) destroyElement(light) end addEventHandler("onClientPlayerVehicleExit",getRootElement(),destroy) Link to comment
Overkillz Posted July 11, 2015 Share Posted July 11, 2015 - isPedInVehicle - getElementHealth - getElementVelocity ... You have to multiplicate the size of the rectangle per the status of u want. Sorry for don't explain it correctly. Link to comment
Gr0x Posted July 11, 2015 Share Posted July 11, 2015 If you click those functions, you can find examples. Noone is going to write a full code for you here Link to comment
SpecT Posted July 11, 2015 Share Posted July 11, 2015 Of course it won't close ... Use removeEventHandler for the function "draw" and dont use these variables! Link to comment
LabiVila Posted July 11, 2015 Share Posted July 11, 2015 Yes, almost everyone uses dxDrawText to write texts. As for editboxes, you can either use a real editbox, or draw another rectangle and an editbox upfront it, and set editbox's alpha to 0, that way you can write there. I personally never use progress-bars as some math can solve anything. and destroyElements aren't used for dx things, you have to use removeEventHandler as said above. function destroy () removeEventHandler ("onClientRender", root, draw) end addEventHandler("onClientPlayerVehicleExit",getRootElement(),destroy) Link to comment
#RooTs Posted July 12, 2015 Share Posted July 12, 2015 try this function draw () local theVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( theVehicle ) then dxDrawRectangle(929, 619, 170, 33, tocolor(57, 59, 50, 100), false) dxDrawRectangle(929, 576, 170, 33, tocolor(57, 59, 50, 100), false) dxDrawRectangle(929, 533, 170, 33, tocolor(57, 59, 50, 100), false) dxDrawRectangle(929, 490, 170, 33, tocolor(57, 59, 50, 100), false) dxDrawRectangle(929, 447, 170, 33, tocolor(57, 59, 50, 100), false) dxDrawRectangle(929, 404, 170, 33, tocolor(57, 59, 50, 100), false) end end addEventHandler("onClientRender", root, draw) Link to comment
HUNGRY:3 Posted July 12, 2015 Share Posted July 12, 2015 try this function draw () local theVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( theVehicle ) then dxDrawRectangle(929, 619, 170, 33, tocolor(57, 59, 50, 100), false) dxDrawRectangle(929, 576, 170, 33, tocolor(57, 59, 50, 100), false) dxDrawRectangle(929, 533, 170, 33, tocolor(57, 59, 50, 100), false) dxDrawRectangle(929, 490, 170, 33, tocolor(57, 59, 50, 100), false) dxDrawRectangle(929, 447, 170, 33, tocolor(57, 59, 50, 100), false) dxDrawRectangle(929, 404, 170, 33, tocolor(57, 59, 50, 100), false) end end addEventHandler("onClientRender", root, draw) This will just show rectangle not the health or the other things Link to comment
#RooTs Posted July 13, 2015 Share Posted July 13, 2015 I made the example for you, friend. not work ? 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