Jump to content

x[طلب]x كيف اغير شكل ScrollBar


Recommended Posts

شف المسألة يبيلها شوية حسابات

شوف المثال وحاول تطبق عليه طلبك

function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) 
    if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then 
    local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) 
        if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then 
            for i, v in ipairs( aAttachedFunctions ) do 
                if v == func then  
                return true 
                end 
            end 
        end 
    end 
    return false 
end 
  
  
   
scrollbar = guiCreateScrollBar(0.29, 0.44, 0.39, 0.05, true, true)     
guiSetVisible ( scrollbar , false ) 
guiSetAlpha ( scrollbar , 0 ) 
  
local screenW, screenH = guiGetScreenSize() 
  
local x_, y_ = ( screenW / 800 ), ( screenH / 600 ) 
  
local x = 0 
  
    function Scr() 
        local x__ = x + 269  
        dxDrawLine(screenW * 0.3337, screenH * 0.4750, screenW * 0.6275, screenH * 0.4750, tocolor(255, 255, 255, 255), 1, true) 
        dxDrawLine(screenW * 0.3337, screenH * 0.4750, screenW * 0.3337, screenH * 0.5067, tocolor(255, 255, 255, 255), 1, true) 
        dxDrawRectangle( x_*x__ , y_*285, x_*17, y_*20, tocolor(0, 0, 0, 255), false) 
        dxDrawLine(screenW * 0.6275, screenH * 0.4750, screenW * 0.6275, screenH * 0.5083, tocolor(255, 255, 255, 255), 1, false) 
        dxDrawLine(screenW * 0.3337, screenH * 0.5083, screenW * 0.6275, screenH * 0.5083, tocolor(255, 255, 255, 255), 1, true) 
      end 
  
  
bindKey ( "f3","down",function (  )  
  
if isEventHandlerAdded ( "onClientRender", root , Scr ) then 
  
removeEventHandler ( "onClientRender", root , Scr ) 
  
guiSetVisible ( scrollbar , false ) 
  
showCursor ( false ) 
  
else 
  
addEventHandler("onClientRender", root,Scr) 
  
guiSetVisible ( scrollbar , true ) 
  
showCursor ( true ) 
  
    end 
end 
    ) 
  
  
addEventHandler("onClientGUIScroll",getRootElement(), 
  
    function (  ) 
  
    if ( source == scrollbar ) then 
    
    Pos = guiScrollBarGetScrollPosition ( scrollbar )  
  
    x = Pos * 2.17  
      
    end 
end 
    ) 
     
     
Link to comment
شف المسألة يبيلها شوية حسابات

شوف المثال وحاول تطبق عليه طلبك

function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) 
    if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then 
    local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) 
        if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then 
            for i, v in ipairs( aAttachedFunctions ) do 
                if v == func then  
                return true 
                end 
            end 
        end 
    end 
    return false 
end 
  
  
   
scrollbar = guiCreateScrollBar(0.29, 0.44, 0.39, 0.05, true, true)     
guiSetVisible ( scrollbar , false ) 
guiSetAlpha ( scrollbar , 0 ) 
  
local screenW, screenH = guiGetScreenSize() 
  
local x_, y_ = ( screenW / 800 ), ( screenH / 600 ) 
  
local x = 0 
  
    function Scr() 
        local x__ = x + 269  
        dxDrawLine(screenW * 0.3337, screenH * 0.4750, screenW * 0.6275, screenH * 0.4750, tocolor(255, 255, 255, 255), 1, true) 
        dxDrawLine(screenW * 0.3337, screenH * 0.4750, screenW * 0.3337, screenH * 0.5067, tocolor(255, 255, 255, 255), 1, true) 
        dxDrawRectangle( x_*x__ , y_*285, x_*17, y_*20, tocolor(0, 0, 0, 255), false) 
        dxDrawLine(screenW * 0.6275, screenH * 0.4750, screenW * 0.6275, screenH * 0.5083, tocolor(255, 255, 255, 255), 1, false) 
        dxDrawLine(screenW * 0.3337, screenH * 0.5083, screenW * 0.6275, screenH * 0.5083, tocolor(255, 255, 255, 255), 1, true) 
      end 
  
  
bindKey ( "f3","down",function (  )  
  
if isEventHandlerAdded ( "onClientRender", root , Scr ) then 
  
removeEventHandler ( "onClientRender", root , Scr ) 
  
guiSetVisible ( scrollbar , false ) 
  
showCursor ( false ) 
  
else 
  
addEventHandler("onClientRender", root,Scr) 
  
guiSetVisible ( scrollbar , true ) 
  
showCursor ( true ) 
  
    end 
end 
    ) 
  
  
addEventHandler("onClientGUIScroll",getRootElement(), 
  
    function (  ) 
  
    if ( source == scrollbar ) then 
    
    Pos = guiScrollBarGetScrollPosition ( scrollbar )  
  
    x = Pos * 2.17  
      
    end 
end 
    ) 
     
     

يا ريت تشرح عن كودك لاني مافهمت شي

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