Jump to content

[HELP] Messed fonts


LabiVila

Recommended Posts

Hello over and over again;

--client

local x,y = guiGetScreenSize () 
  
function dailyShits () 
    dxDrawRectangle (x/1.65, y/5, x/3, y/5, tocolor (0, 0, 0, 150)) 
    dxDrawText ("Daily Rewards:", x/1.6, y/4.65, x, y, tocolor (255, 255, 255, 255), 1.25, "clear")  
    dxDrawText ("1. Get 10 hunters", x/1.6, y/3.8, x, y, tocolor (255, 255, 255, 255), 1, "clear") 
    dxDrawText ("2. Win 10 maps", x/1.6, y/3.3, x, y, tocolor (255, 255, 255, 255), 1, "clear") 
  
end 
addEventHandler ("onClientRender", root, dailyShits) 
  
function addPoint (hunters) 
    addEventHandler ("onClientPreRender", root, 
        function () 
            dxDrawText (hunters.."/10", x/3, y/3, x, y, tocolor (0, 0, 0, 150), 7, "clear") 
        end 
    ) 
end 
addEvent ("hunterADD", true) 
addEventHandler ("hunterADD", root, addPoint) 

--server

local hunters = 0 
  
function hunterPickups (pickupID, pickupType, vehicleModel) 
    if pickupType == "vehiclechange" and vehicleModel == 425 then 
        outputChatBox ("one more hunter", source) 
        hunters = hunters + 1 
        triggerClientEvent (source, "hunterADD", source, hunters) 
    end 
end 
addEventHandler ("onPlayerPickUpRacePickup", root, hunterPickups) 

Everything works cool but something is wrong in dxDrawText (hunter....). Here's a screen of the "bug":

http://gyazo.com/2c0d4ca9820324e3e5c57e043b08e2b5

and it must be like, 1 then 2 then 3.. and etc.

Link to comment
Why are you using onClientPreRender?

It will make the server lag and may cause a crash if its not used properly.

Try using onClientRender.

There's not really a difference between these, it's just a different state of the render process.

https://wiki.multitheftauto.com/wiki/Ga ... sing_Order

Try using something like this:

local x,y = guiGetScreenSize () 
local showHunterPoints = false 
local hunters = 0 
      
function fName () 
    dxDrawRectangle (x/1.65, y/5, x/3, y/5, tocolor (0, 0, 0, 150)) 
    dxDrawText ("Daily Rewards:", x/1.6, y/4.65, x, y, tocolor (255, 255, 255, 255), 1.25, "clear") 
    dxDrawText ("1. Get 10 hunters", x/1.6, y/3.8, x, y, tocolor (255, 255, 255, 255), 1, "clear") 
    dxDrawText ("2. Win 10 maps", x/1.6, y/3.3, x, y, tocolor (255, 255, 255, 255), 1, "clear")  
    if ( showHunterPoints and hunters ) then 
        dxDrawText (hunters.."/10", x/3, y/3, x, y, tocolor (0, 0, 0, 150), 7, "clear") 
    end  
end 
addEventHandler ("onClientRender", root, fName ) 
      
function addPoint (hunt) 
    showHunterPoints = true 
    hunters = hunt 
end 
addEvent ("hunterADD", true) 
addEventHandler ("hunterADD", root, addPoint) 

Link to comment

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...