Jump to content

مساعدة بيوسفل فنكشن isCursorOverText


Recommended Posts

الحين مسوي لوحة دي اكس و المفروض يوم احط الماوس يفعل الحدث

المشكلة اول واحدة بس تنفع ثاني واحدة لا
 

if (isCursorOverText(gw * 0.3623, gh * 0.2604, gw * 0.6377, gh * 0.2995)) then
dxDrawText("# Shop System #", gw * 0.3623, gh * 0.2604, gw * 0.6377, gh * 0.2995, tocolor(255, 0, 0, 255), 2, "default-bold", "center", "center", false, false, true, false, false)
else
dxDrawText("# Shop System #", gw * 0.3623, gh * 0.2604, gw * 0.6377, gh * 0.2995, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, true, false, false)
end
-------------------------------------------------------------------------------------------------------------------------
if (isCursorOverText(gw * 0.3623, gh * 0.3763, gw * 0.6377, gh * 0.2995)) then
dxDrawText("# VIP System #", gw * 0.3623, gh * 0.3763, gw * 0.6377, gh * 0.2995, tocolor(255, 0, 0, 255), 2, "default-bold", "center", "center", false, false, true, false, false)
else
dxDrawText("# VIP System #", gw * 0.3623, gh * 0.3763, gw * 0.6377, gh * 0.2995, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, true, false, false)
end
end

الي يعرف الحل يكرمنا بحله

Link to comment
3 hours ago, [T]|O|[P]George said:

الحين مسوي لوحة دي اكس و المفروض يوم احط الماوس يفعل الحدث

المشكلة اول واحدة بس تنفع ثاني واحدة لا
 


if (isCursorOverText(gw * 0.3623, gh * 0.2604, gw * 0.6377, gh * 0.2995)) then
dxDrawText("# Shop System #", gw * 0.3623, gh * 0.2604, gw * 0.6377, gh * 0.2995, tocolor(255, 0, 0, 255), 2, "default-bold", "center", "center", false, false, true, false, false)
else
dxDrawText("# Shop System #", gw * 0.3623, gh * 0.2604, gw * 0.6377, gh * 0.2995, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, true, false, false)
end
-------------------------------------------------------------------------------------------------------------------------
if (isCursorOverText(gw * 0.3623, gh * 0.3763, gw * 0.6377, gh * 0.2995)) then
dxDrawText("# VIP System #", gw * 0.3623, gh * 0.3763, gw * 0.6377, gh * 0.2995, tocolor(255, 0, 0, 255), 2, "default-bold", "center", "center", false, false, true, false, false)
else
dxDrawText("# VIP System #", gw * 0.3623, gh * 0.3763, gw * 0.6377, gh * 0.2995, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, true, false, false)
end
end

الي يعرف الحل يكرمنا بحله

عندك end زايده في الكود الثاني 

على حسب ما اشوف لاني اساعدك من الجوال 

 

End 1 = if 

End 2 =? 

Edited by +1HidroNex
Link to comment
3 minutes ago, Debo15 said:

اطرح اكواد الوظيفة ذي

function isMouseInPosition ( x, y, width, height )
	if ( not isCursorShowing( ) ) then
		return false
	end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
        return true
    else
        return false
    end
end

-- Modified version for DX Text
function isCursorOverText(posX, posY, sizeX, sizeY)
    if(isCursorShowing()) then
        local cX, cY = getCursorPosition()
        local screenWidth, screenHeight = guiGetScreenSize()
        local cX, cY = (cX*screenWidth), (cY*screenHeight)
        if(cX >= posX and cX <= posX+(sizeX - posX)) and (cY >= posY and cY <= posY+(sizeY - posY)) then
            return true
        else
            return false
        end
    else
        return false	
    end
end
isCursorOverText(posX, posY, sizeX, sizeY)

 

Link to comment
1 minute ago, [T]|O|[P]George said:

 

 

--#Usefull function
function isMouseInPosition ( x, y, width, height )
	if ( not isCursorShowing( ) ) then
		return false
	end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
        return true
    else
        return false
    end
end

--# Variables
local gw , gh = guiGetScreenSize ( )

--[[Your Code Down ]]--
if ( isMouseInPosition ( gw * 0.3623, gh * 0.2604, gw * 0.6377, gh * 0.2995 ) ) then
	dxDrawText ( "# Shop System #", gw * 0.3623, gh * 0.2604, gw * 0.6377, gh * 0.2995, tocolor(255, 0, 0, 255), 2, "default-bold", "center", "center", false, false, true, false, false )
else
	dxDrawText ( "# Shop System #", gw * 0.3623, gh * 0.2604, gw * 0.6377, gh * 0.2995, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, true, false, false )
end
if ( isMouseInPosition ( gw * 0.3623, gh * 0.3763, gw * 0.6377, gh * 0.2995 ) ) then
	dxDrawText ( "# VIP System #", gw * 0.3623, gh * 0.3763, gw * 0.6377, gh * 0.2995, tocolor(255, 0, 0, 255), 2, "default-bold", "center", "center", false, false, true, false, false )
else
	dxDrawText ( "# VIP System #", gw * 0.3623, gh * 0.3763, gw * 0.6377, gh * 0.2995, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, true, false, false )
end
end

 

Link to comment
5 minutes ago, Debo15 said:

 


--#Usefull function
function isMouseInPosition ( x, y, width, height )
	if ( not isCursorShowing( ) ) then
		return false
	end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
        return true
    else
        return false
    end
end

--# Variables
local gw , gh = guiGetScreenSize ( )

--[[Your Code Down ]]--
if ( isMouseInPosition ( gw * 0.3623, gh * 0.2604, gw * 0.6377, gh * 0.2995 ) ) then
	dxDrawText ( "# Shop System #", gw * 0.3623, gh * 0.2604, gw * 0.6377, gh * 0.2995, tocolor(255, 0, 0, 255), 2, "default-bold", "center", "center", false, false, true, false, false )
else
	dxDrawText ( "# Shop System #", gw * 0.3623, gh * 0.2604, gw * 0.6377, gh * 0.2995, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, true, false, false )
end
if ( isMouseInPosition ( gw * 0.3623, gh * 0.3763, gw * 0.6377, gh * 0.2995 ) ) then
	dxDrawText ( "# VIP System #", gw * 0.3623, gh * 0.3763, gw * 0.6377, gh * 0.2995, tocolor(255, 0, 0, 255), 2, "default-bold", "center", "center", false, false, true, false, false )
else
	dxDrawText ( "# VIP System #", gw * 0.3623, gh * 0.3763, gw * 0.6377, gh * 0.2995, tocolor(0, 0, 0, 255), 1.50, "default-bold", "center", "center", false, false, true, false, false )
end
end

 

لو استعملت ذا isMouseInPosition ( x, y, width, height ) 
احداثيات الكلام ما تيجي صحيحة 

Link to comment
function isMouseInPosition ( x, y, width, height )
	if ( not isCursorShowing( ) ) then
		return false
	end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( ( cx >= x and cx <= ( ( width - x ) + x ) ) and ( cy >= y and cy <= ( ( height - y ) + y ) ) ) then
        return true
    else
        return false
    end
end

جرب هذا 

  • Thanks 1
Link to comment
10 minutes ago, Debo15 said:

function isMouseInPosition ( x, y, width, height )
	if ( not isCursorShowing( ) ) then
		return false
	end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( ( cx >= x and cx <= ( ( width - x ) + x ) ) and ( cy >= y and cy <= ( ( height - y ) + y ) ) ) then
        return true
    else
        return false
    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...