Jump to content

ابي مساعده في كود


Recommended Posts

سويت تعديل بسيط اذا يبي يظهرها و يوخرها من نفس الزر
local gScreenSize = { guiGetScreenSize( ) }; 
local gOffest = 0.4; 
local gIconWidth = 0.35 * gScreenSize[ 1 ]; 
local gHconHalfWidth = gIconWidth / 2; 
  
function renderTheHeadImg( ) 
    for _, players in ipairs( getElementsByType( 'player' ) ) do 
        while true do 
            if not isElementOnScreen( players ) then 
                break 
            end 
            local headX, headY, headZ = getPedBonePosition( players, 8 ); 
            headZ = headZ + gOffest; 
            local absX, absY = getScreenFromWorldPosition ( headX, headY, headZ ); 
            if not absX or not absY then 
                break 
            end 
            local camX, camY, camZ = getCameraMatrix( ); 
            if not isLineOfSightClear ( camX, camY, camZ, headX, headY, headZ, true, false, false, true, false, true, false, players ) then 
                break 
            end 
            dxDrawImages( absX, absY, 'img/1.png', tocolor( 255, 255, 255, 255 ), getDistanceBetweenPoints3D( camX, camY, camZ, headX, headY, headZ ) ); 
            break 
        end 
    end 
end 
  
function dxDrawImages ( posX, posY, iconPath, color, distance ) 
    distance = 1 / distance; 
    dxDrawImage ( posX - gHconHalfWidth * distance, posY - gHconHalfWidth * distance, gIconWidth * distance, gIconWidth * distance, iconPath, 0, 0, 0, color, false ); 
end 
  
isShow = false 
addEventHandler ( 'onClientGUIClick', guiRoot, 
    function( button, state, absoluteX, absoluteY ) 
        if ( source ==  B1 ) then 
            if isShow then 
                removeEventHandler( 'onClientRender', root, renderTheHeadImg ); 
                isShow = false 
            else 
                addEventHandler( 'onClientRender', root, renderTheHeadImg ); 
                isShow = true 
            end 
        end 
    end 
) 

شكرآآ اخوي علىالمساعده

بس ابي اعرف هذا يطلع للكل ولا للي ضغط على الزر بس

وذا للكل ابيه للي ضغط على الزر بس

للي ضغط الزر بس

Link to comment

شباب اذا ابيه يجي فوق الي ظغط الزر ويظهر للكل يعني الي ضغط على الزر الصوره تكون فوقه والي ما ضغط عليه ما تكون فوقه والباقي يشوف انو فوقه صوره اسوي كذا؟

local gScreenSize = { guiGetScreenSize( ) }; 
local gOffest = 0.4; 
local gIconWidth = 0.35 * gScreenSize[ 1 ]; 
local gHconHalfWidth = gIconWidth / 2; 
  
function renderTheHeadImg( ) 
    for _, players in ipairs( getElementsByType( 'player' ) ) do 
        while true do 
            if not isElementOnScreen( players ) then 
                break 
            end 
            local headX, headY, headZ = getPedBonePosition( players, 8 ); 
            headZ = headZ + gOffest; 
            local absX, absY = getScreenFromWorldPosition ( headX, headY, headZ ); 
            if not absX or not absY then 
                break 
            end 
            local camX, camY, camZ = getCameraMatrix( ); 
            if not isLineOfSightClear ( camX, camY, camZ, headX, headY, headZ, true, false, false, true, false, true, false, players ) then 
                break 
            end 
            dxDrawImages( absX, absY, 'img/1.png', tocolor( 255, 255, 255, 255 ), getDistanceBetweenPoints3D( camX, camY, camZ, headX, headY, headZ ) ); 
            break 
        end 
    end 
end 
  
function dxDrawImages ( posX, posY, iconPath, color, distance ) 
    distance = 1 / distance; 
    dxDrawImage ( posX - gHconHalfWidth * distance, posY - gHconHalfWidth * distance, gIconWidth * distance, gIconWidth * distance, iconPath, 0, 0, 0, color, false ); 
end 
  
isShow = false 
addEventHandler ( 'onClientGUIClick', guiRoot, 
    function( button, state, absoluteX, absoluteY ) 
        if ( source ==  B1 ) then 
            if isShow then 
                removeEventHandler( 'onClientRender', getRootElement, renderTheHeadImg ); 
                isShow = false 
            else  
                addEventHandler( 'onClientRender', getRootElement, renderTheHeadImg ); 
                isShow = true 
            end 
        end 
    end 
) 

Link to comment
  • 1 year later...

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