Jump to content

x[طلب ]X كود وضع تاج فوق الراس


Recommended Posts

Event: "onClientGUIClick"

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 

isEventHandlerAdded 
addEventHandler 
removeEventHandler 
-- Rendering 
getCameraMatrix 
getElementPosition 
getDistanceBetweenPoints3D 
getScreenFromWorldPosition 

ممكن تستفيد من هذا الكود .. :

--\\\\\\\\\\\\\\\\\\\\\\\\\\ 
--//    Setting 
  
local g_screenX, g_screenY = guiGetScreenSize(); 
local gScale = 0.3; 
local gAlphaDistance = 25; 
local gMaxDistance = 50; -- Max Distance 
local gTextAlpha = 120; 
local gTextSize = 1; 
local gAlphaDiff = gMaxDistance - gAlphaDistance; 
gScale = 1 / gScale * 800 / g_screenY; 
local gMaxScaleCurve = { { 0, 0 }, { 3, 3 }, { 13, 5 } }; 
local gTextScaleCurve = { { 0, 0.8 }, { 0.8, 1.2 }, { 99, 99 } }; 
local gTextAlphaCurve = { { 0, 0 }, { 25, 100 }, { 120, 190 }, { 255, 190 } }; 
  
local marker = createMarker( ... ); -- كمل الارقمنت النآقصه 
  
addEventHandler ( 'onClientRender', root, 
    function ( ) 
        local x, y, z = getCameraMatrix( ); 
        local x1, y1, z1 = getElementPosition ( marker ); 
        local distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ); 
        if distance <= gMaxDistance then 
            local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ); 
            if x1_ and y1_ then 
                local scale = 1 / ( gScale * ( distance / gMaxDistance ) ); 
                local alpha = ( ( distance - gAlphaDistance ) / gAlphaDiff ); 
                alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); 
                scale = math.evalCurve( gMaxScaleCurve, scale ); 
                local textscale = math.evalCurve( gTextScaleCurve, scale ); 
                local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); 
                dxDrawText( "#FFFF00The Text Here", x1_, y1_, x1_, y1_, tocolor ( 255, 255, 255, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); 
            end 
        end 
    end 
); 
  
-- ////////////////////////////////// 
-- //       MATH FUNCTIONS         // 
-- ////////////////////////////////// 
  
function math.evalCurve( curve, input ) 
    if input < curve[ 1 ][ 1 ] then 
        return curve[ 1 ][ 2 ]; 
    end 
    for idx = 2, #curve do 
        if input < curve[ idx ][ 1 ] then 
            local x1 = curve[ idx - 1 ][ 1 ]; 
            local y1 = curve[ idx - 1 ][ 2 ]; 
            local x2 = curve[ idx ][ 1 ]; 
            local y2 = curve[ idx ][ 2 ]; 
            local alpha = ( input - x1 ) / ( x2 - x1 ); 
            return math.lerp( y1, y2, alpha ); 
        end 
    end 
    return curve[ #curve ][ 2 ]; 
end 
  
function math.lerp( from, to, alpha ) 
    return from + ( to-from ) * alpha; 
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...