Jump to content

onClientRender Use


Brad96

Recommended Posts

Posted

the onClientRender is obliged to use function dxDraw ? because without that and I try not work .. have to create a function for this start ?

Mi Nick En El Juego : Bs|Brad

Mi Skype : fer_va_96

Posted

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?

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted

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 ) 
  
  

Mi Nick En El Juego : Bs|Brad

Mi Skype : fer_va_96

Posted

ofc you need to use onClientRender event to draw the zone name.

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

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.

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted

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.

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted

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) 

 DUyJ810.gif

Posted

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) 

A unique GangWar gamemode waiting for you!
Click here for more information.

560x95_FFFFFF_FF9900_000000_000000.png

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...