Brad96 Posted June 14, 2015 Share Posted June 14, 2015 the onClientRender is obliged to use function dxDraw ? because without that and I try not work .. have to create a function for this start ? Link to comment
Dealman Posted June 14, 2015 Share Posted June 14, 2015 I'm sorry but I haven't got a clue what you just asked... Are you asking if onClientRender can only trigger drawing functions, or what? Link to comment
Brad96 Posted June 14, 2015 Author Share Posted June 14, 2015 yes ,is necesary use the onClientRender with dxDraw functions ? because ... -- Draw zone name text. dxDrawText ( playerZoneName, 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "pricedown" ) end function HandleTheRendering ( ) addEventHandler ( "onClientRender", root, createText ) -- here work end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) but dxDrawText ( playerZoneName, 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "pricedown" ) end -- here dont work addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) Link to comment
Walid Posted June 14, 2015 Share Posted June 14, 2015 ofc you need to use onClientRender event to draw the zone name. Link to comment
Dealman Posted June 14, 2015 Share Posted June 14, 2015 DX Drawings only draw for one frame. So if you try to draw it at the start of the script, or on resource start - it will only draw once and you'll barely be able to notice it. onClientRender triggers whatever function it is attached to every frame, so whatever's in that function will be run 30-60 times a second. Link to comment
Brad96 Posted June 14, 2015 Author Share Posted June 14, 2015 I mean any text that has to be updated ? Link to comment
Dealman Posted June 14, 2015 Share Posted June 14, 2015 Not sure what you mean, but if you're drawing text stored in a variable, that text will be updated as soon as you change the variable itself. Link to comment
#RooTs Posted June 15, 2015 Share Posted June 15, 2015 try this my example local sx,sy = guiGetScreenSize() local px,py = 1280,720 -- screen in HD local x,y = (sx/px), (sy/py) function HUD () dxDrawText(playerZoneName, x*990, y*153, x*40, y*40, tocolor(255,255,255,255), 1,"pricedown",false,false,false,true) end addEventHandler("onClientRender", root, HUD) Link to comment
xeon17 Posted June 15, 2015 Share Posted June 15, 2015 To update a text you can do something like this: I made this example for you , didn't tested it , but it should work well theText = 'Status: Outside ColShape' RadarArea(-336.51535, 1016.52850,380,200,255,255,255,150) Area = ColShape.Rectangle(-336.51535, 1016.52850,380,200) addEventHandler('onClientElementColShapeHit',resourceRoot, function (matchingDimension) if source.type == 'player' and source == localPlayer and matchingDimension then theText = 'Status: in ColShape' end end) addEventHandler('onClientElementColShapeLeave',resourceRoot, function (matchingDimension) if source.type == 'player' and source == localPlayer and matchingDimension then theText = 'Status: Outside ColShape' end end) function Render () dxDrawText ( theText,44,screenHeight-43 screenWidth,screenHeight,tocolor(255,255,255,255),1,"pricedown") end addEventHandler('onClientRender',root,Render) 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