nGear Posted July 5, 2015 Share Posted July 5, 2015 Hey guys, i've been writing a little CCTV script, but for some reason dxDrawText&dxDrawRectangle are NOT working with onClientRender or anything else, even a friend called "Asus" who is very experienced in DX had no idea why this didn't work. The problem is simple, the texts only draw at the very first seconds of the start from the script, they only work for a tiny amount of seconds(atleast 2 of the 3 texts). dxDrawText("CAMERA "..login.CCTVcurrent, 0, 0, sX, sY, tocolor(255, 255, 255, 255), scaleY*0.3, font, "right", "bottom", false, false, true, true) dxDrawText("DATE", 0, 0, sX, sY, tocolor(255, 255, 255, 255), scaleY*0.3, font, "left", "top", false, false, true, true) dxDrawText("TIME", 0, 0, sX, sY, tocolor(255, 255, 255, 255), scaleY*0.3, font, "right", "top", false, false, true, true) sX&sY are screenWidth&Heigth, scaleY is sY/1920, font is a custom DX font or clear if it failed to create it. For some reason, the only text that draws is DATE, the other 2 texts only appear for about 1 second then instantly disappear. I have tried putting them on a renderTarget, didn't work. I have tried putting them in different functions, didn't work. I have tried using onClientRender and onClientPreRender, didn't work. I have tried putting them in a seperate resource, WORKED. But i have no idea why. The texts only draw if they are on the top left, putting them bottom left/right or top right makes them only appear for a second. I checked my VRAM with dxGetStatus but i have more than 3gb left for MTA, about 200 used for shaders&rendertargets and 16 used for fonts There are no errors or warnings in debugscript 3. Link to comment
xXMADEXx Posted July 5, 2015 Share Posted July 5, 2015 Can you post the whole script for the onClientRender block? Link to comment
nGear Posted July 5, 2015 Author Share Posted July 5, 2015 Can you post the whole script for the onClientRender block? That is the whole block. Let me post everything related to the dxDrawText's login = {} login.CCTVcurrent = 1 login.CCTVenabled = true sX, sY = guiGetScreenSize() scaleX = sX/1920 scaleY = sY/1080 function drawText() if login.CCTVenabled then dxDrawText("CAMERA "..login.CCTVcurrent, 0, 0, sX, sY, tocolor(255, 255, 255, 255), scaleY*0.3, font, "right", "bottom", false, false, true, true) dxDrawText("DATE", 0, 0, sX, sY, tocolor(255, 255, 255, 255), scaleY*0.3, font, "left", "top", false, false, true, true) dxDrawText("TIME", 0, 0, sX, sY, tocolor(255, 255, 255, 255), scaleY*0.3, font, "right", "top", false, false, true, true) end end addEventHandler("onClientRender", root, drawText) login is a table, fyi The thing is, that the text's only draw in the top left, if i change the positions to right top or anywhere else they stop working Obviously, this isn't the whole script, the whole script is about 900 lines long(a bit less) and has way more stuff than just the CCTV EDIT: stupid me, i forgot to make some variables(also called sX&sY) which are used for starting Position X&Y local. Don't know how i could miss that, i'll say its because its 6AM right now Thanks anyways! //Thread Closed 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