iiv03 Posted November 13, 2019 Share Posted November 13, 2019 (edited) hey the text not showing when map start why where problem here? sX, sY = guiGetScreenSize() tables = { moveY = sY+sY*0.5, moveX = sX*0.5-sX*0, fontSize = 1.00, font = dxCreateFont("font/font.ttf",17) or "default-bold" } function render() local x = tables.moveX local y = tables.moveY local width = sX*0.01 + tables.moveX local height = sY*0.05 dxDrawText("Alpha 1.0.2 still work on Developer",x,y,width,height,tocolor(255,255,255,230),tables.fontSize,tables.font,"center","center",false) setTimer(function () removeEventHandler("onClientRender",root,render) end,5000,1) end addEventHandler("onClientMapStarting",root,function () addEventHandler("onClientRender",root,render) end) lol i used that event onClientScreenFadedIn and worked i don't know what happen have another question how can i check command? in function like /random use this? https://wiki.multitheftauto.com/wiki/GetCommandHandlers i wanna something if he type /random == then removeEventHandler Edited November 13, 2019 by xFabel Link to comment
Moderators IIYAMA Posted November 13, 2019 Moderators Share Posted November 13, 2019 3 hours ago, xFabel said: and worked i don't know what happen Probably out of the screen. dxDrawText doesn't require width and height. It needs a start-point(x1,y1) and end-point(x2,y2). Between those points is the box where your text is placed. local startX, startY = 0, sY - (sY*0.5) local endX, endY = sX, sY dxDrawText("Alpha 1.0.2 still work on Developer",startX, startY, endX, endY, tocolor(255,255,255,230),tables.fontSize,tables.font,"center","center",false) (I can't figure out the text position based on your code) 1 Link to comment
iiv03 Posted November 13, 2019 Author Share Posted November 13, 2019 (edited) 20 minutes ago, IIYAMA said: Probably out of the screen. dxDrawText doesn't require width and height. It needs a start-point(x1,y1) and end-point(x2,y2). Between those points is the box where your text is placed. local startX, startY = 0, sY - (sY*0.5) local endX, endY = sX, sY dxDrawText("Alpha 1.0.2 still work on Developer",startX, startY, endX, endY, tocolor(255,255,255,230),tables.fontSize,tables.font,"center","center",false) (I can't figure out the text position based on your code) I just did normal like that dxDrawText("Alpha 1.0.2 still work on Developer",450,250,150,150,tocolor(255,255,255,230),tables.fontSize,tables.font,"center","center",false) and didn't work what is the reason? Edited November 13, 2019 by xFabel Link to comment
Moderators IIYAMA Posted November 13, 2019 Moderators Share Posted November 13, 2019 (edited) 27 minutes ago, xFabel said: I just did normal like that dxDrawText("Alpha 1.0.2 still work on Developer",450,250,150,150,tocolor(255,255,255,230),tables.fontSize,tables.font,"center","center",false) and didn't work what is the reason? Also the moment for adding and removing the event can be better. + check if the event is triggered. local displayDevTimer addEventHandler("onClientMapStarting",root,function () iprint("onClientMapStarting is triggered") if isTimer(displayDevTimer) then resetTimer(displayDevTimer) iprint("resetTimer") else addEventHandler("onClientRender",root,render) iprint("addEvent") displayDevTimer = setTimer(function () removeEventHandler("onClientRender",root,render) displayDevTimer = nil iprint("removeEvent") end,5000,1) end end) Edited November 13, 2019 by IIYAMA 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