DxDrawLoading

From Multi Theft Auto: Wiki
Revision as of 21:32, 3 September 2015 by Loos5092 (talk | contribs) (dxDrawLoading)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Click to collapse [-]
Client

Syntax

bool dxDrawLoading ( int posX, int posY, int width , int height , int posX2 , int posY2 , int size [ int color , int color2 ] int time )

posX = x coordinates of the form posY = y coordinates of the form width = Display format height = Length figure posX2 = Writing for the coordinates x posY2 = Writing for the coordinates y size = size Text color = Color hard form color2 = Color animated form time = time for end Loading

Code :

local start = getTickCount()
function dxDrawLoading (x, y, width, height, x2, y2, size, color, color2, second)
    local now = getTickCount()
    local seconds = second
    local with = interpolateBetween(0,0,0,width,0,0, (now - start) / ((start + seconds) - start), "Linear")
    local text = interpolateBetween(0,0,0,100,0,0,(now - start) / ((start + seconds) - start),"Linear")
        dxDrawText ( "Loading ... "..math.floor(text).."%", x2, y2 , width, height, tocolor ( 0, 255, 0, 255 ), size, "pricedown" )
        dxDrawRectangle(x, y ,width ,height -10, color)
        dxDrawRectangle(x, y, with ,height -10, color2)
        end

Example :

addEventHandler("onClientRender",root,
        function ()
        dxDrawLoading(196, 482,422, 58, 196 , 450 ,1.00,tocolor(0,0,0,170),tocolor(0,255,0,170),10000)
   if now < start + seconds then
      --- code in End Loading ..
        end
        end)