Jump to content

حل مشكله


Recommended Posts

وش المشكله هنا

local R, G, B = 255, 255, 255

local R2, G2, B2 = guiScrollBarGetScrollPosition( GUIEditor.scrollbar[1] ), guiScrollBarGetScrollPosition( GUIEditor.scrollbar[2] ), guiScrollBarGetScrollPosition( GUIEditor.scrollbar[3] )



addEventHandler( "onClientGUIScroll", root,
	function( Scrolled )
		if Scrolled == GUIEditor.scrollbar[1] then
			if R2 <= 1.0 then
				R = 255
			elseif R2 == R2 + 2.0 then
				R = R - 5
			end
		end
	end
)

 

Link to comment
7 hours ago, +Source|> said:

وش المشكله هنا


local R, G, B = 255, 255, 255

local R2, G2, B2 = guiScrollBarGetScrollPosition( GUIEditor.scrollbar[1] ), guiScrollBarGetScrollPosition( GUIEditor.scrollbar[2] ), guiScrollBarGetScrollPosition( GUIEditor.scrollbar[3] )



addEventHandler( "onClientGUIScroll", root,
	function( Scrolled )
		if Scrolled == GUIEditor.scrollbar[1] then
			if R2 <= 1.0 then
				R = 255
			elseif R2 == R2 + 2.0 then
				R = R - 5
			end
		end
	end
)

 

وش تبي تسوي بالضبط؟

Edited by Simple.
Link to comment

سويتلك مثال بسيط , وجربته وشغال

local R, G, B = 255, 255, 255


GUIEditor = {
    scrollbar = {},
    window = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
local screenW, screenH = guiGetScreenSize()
        GUIEditor.window[1] = guiCreateWindow(screenW - 320 - 10, (screenH - 197) / 2, 320, 197, "", false)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetAlpha(GUIEditor.window[1], 1.00)

        GUIEditor.scrollbar[1] = guiCreateScrollBar(65, 90, 197, 18, true, false, GUIEditor.window[1])    
    end
)

addEventHandler("onClientRender", root,
    function()
		local screenW, screenH = guiGetScreenSize()
        dxDrawText("change colour", (screenW - 191) / 2, (screenH - 41) / 2, ((screenW - 191) / 2) + 191, ( (screenH - 41) / 2) + 41, tocolor(R, G, B, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false)
    end
)


addEventHandler( "onClientGUIScroll", resourceRoot,
	function( ) 
	    if ( source == GUIEditor.scrollbar[1] ) then  
		local ScrollPosition_ = guiScrollBarGetScrollPosition ( GUIEditor.scrollbar[1] )
			ScrollPosition_2 = ScrollPosition_
			R = R - ScrollPosition_
		end	
	end 
)

 

  • Like 1
Link to comment

استخدم الداله اللي تحت

بالنسبة المئوية RGBA راح تعطيك الـ

function getRGBAByPercentage(rPercentage,gPercentage,bPercentage,aPercentage)
	-- ارقمنت إجبارية
		--> rPercentage : نسبة الأحمر
		--> gPercentage : نسبة الأخضر
		--> bPercentage : نسبة الأزرق
	-- ارقمنت اختيارية
		--> aPercentage : نسبة الشفافية

	if rPercentage and gPercentage and bPercentage then
		if type(rPercentage)=="number" and type(gPercentage)=="number" and type(bPercentage)=="number" then
			local aR,aG,aB,aA;
			aR=(255/100)*rPercentage;aG=(255/100)*gPercentage;aB=(255/100)*bPercentage;
			if aPercentage and type(aPercentage)=="number" then
				aA=(255/100)*aPercentage;
			end
			return aR,aG,aB,aA
		else
			return print("the values must be numbers");
		end
	else
		return print("invalid!");
	end
	return false
end


-- تجربه
print(getRGBAByPercentage(100,40,98)) -- 255.0	102.0	249.9	false
local r,g,b,a=getRGBAPercentage(100,100,100,100);
r: 255.0
g: 255.0
b: 255.0
a: 255.0

 

لا تنسى تستخدم

guiScrollBarGetScrollPosition

عشان تجيب النسبة المئوية للسكرول بار

Edited by NX_CI
  • Like 1
Link to comment
local screenWidth, screenHeight = guiGetScreenSize ( )
local scroll = guiCreateScrollBar(15,81,24,245,false,false)
local scroll2 = guiCreateScrollBar(45,81,24,245,false,false)
local scroll3 = guiCreateScrollBar(75,81,24,245,false,false)

local R, G, B = 0, 0, 0


addEventHandler( "onClientGUIScroll", root, 
function()
	local ScrollValue = guiScrollBarGetScrollPosition ( source )
    if source == scroll then
    	R = (255/100) * ScrollValue
	elseif source == scroll2 then
		G = (255/100) * ScrollValue
	elseif source == scroll3 then
		B = (255/100) * ScrollValue
	end
end)

function createText ( )
    local playerX, playerY, playerZ = getElementPosition ( localPlayer )       -- Get our player's coordinates.
    local playerZoneName = getZoneName ( playerX, playerY, playerZ )          -- Get name of the zone the player is in.

    -- Draw zone name text's shadow.
    dxDrawText ( playerZoneName, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" )
    -- Draw zone name text.
    dxDrawText ( playerZoneName, 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( R, G, B, 255 ), 1, "pricedown" )
end

function HandleTheRendering ( )
    addEventHandler ( "onClientRender", root, createText ) -- keep the text visible with onClientRender.
end

addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering )

@+Source|>

  • Like 1
Link to comment
15 hours ago, Simple. said:

local screenWidth, screenHeight = guiGetScreenSize ( )
local scroll = guiCreateScrollBar(15,81,24,245,false,false)
local scroll2 = guiCreateScrollBar(45,81,24,245,false,false)
local scroll3 = guiCreateScrollBar(75,81,24,245,false,false)

local R, G, B = 0, 0, 0


addEventHandler( "onClientGUIScroll", root, 
function()
	local ScrollValue = guiScrollBarGetScrollPosition ( source )
    if source == scroll then
    	R = (255/100) * ScrollValue
	elseif source == scroll2 then
		G = (255/100) * ScrollValue
	elseif source == scroll3 then
		B = (255/100) * ScrollValue
	end
end)

function createText ( )
    local playerX, playerY, playerZ = getElementPosition ( localPlayer )       -- Get our player's coordinates.
    local playerZoneName = getZoneName ( playerX, playerY, playerZ )          -- Get name of the zone the player is in.

    -- Draw zone name text's shadow.
    dxDrawText ( playerZoneName, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" )
    -- Draw zone name text.
    dxDrawText ( playerZoneName, 44, screenHeight - 43, screenWidth, screenHeight, tocolor ( R, G, B, 255 ), 1, "pricedown" )
end

function HandleTheRendering ( )
    addEventHandler ( "onClientRender", root, createText ) -- keep the text visible with onClientRender.
end

addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering )

@+Source|>

تسلم

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