Jump to content

mouse enter


Recommended Posts

السلام عليكم ورحمه الله وبركاته

اخباركم

عندي مشكله لما يدخل الماوس مثلن بليبل ابي تتغير الشفافيه لكن ما يحصل شي مدري ليه

الكود

addEventHandler('onClientMouseEnter',root, 
function() 
if ( source == GUIEditor.label[12] ) then 
guiSetAlpha(GUIEditor.button[2], 3.00) 
 end 
 end 
 ) 

+ممكن فنكشن يتحقق من عدد الاعبين في عالم وهمي معين

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

Link to comment

كودك الاول صحيح

بس عشانك حاط ( 3.00 ) ء

وهو اخر شيء 1

الطلب الثاني مافهمت عليك

الطلب الثالث تفضل

createAnimation

client only

لكنها تستخدم بدون رندر وبسهولة وببساطة interpolateBetween الوظيفة مثل

ويعني لو بغيت تسوي حركات على اللوحة او على اي شي ثاني مو بس حركات يمديك تستخدمها في اشياء ثانية interpolateBetween تختصر استخدام

[color=#FF0000]createAnimation[/color]([color=#008000]int[/color] from, [color=#008000]int[/color] to, [color=#008000]int/string[/color] easing, [color=#008000]int[/color] duration, [color=#008000]function[/color] onChange) 

Required Arguments

---from: the start value

---to: the end value

---easing: the easing function to use for the animation or can be used the easing number, e.g. "Linear" = 1, "InQuad" = 2, "OutQuad" = 3, ...

---duration: the duration of animation

---onChange: the function to call when the animation value is changed

Code :

anims = { } 
builtins={ "Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce", "SineCurve", "CosineCurve" } 
function table.find(t, v) 
    for k,a in ipairs(t) do 
        if a == v then return true end 
    end 
    return false 
end 
function createAnimation(f, t, easing, duration, onChange) 
    assert(type(f) == "number", "Bad argument @ 'createAnimation' [expected number at argument 1, got "..type(f).."]") 
    assert(type(t) == "number", "Bad argument @ 'createAnimation' [expected number at argument 2, got "..type(t).."]") 
    assert(type(easing) == "string" or (type(easing) == "number" and (easing >= 1 or easing <= #builtins)), "Bad argument @ 'createAnimation' [invalid easing at argument 3]") 
    assert(type(duration) == "number", "Bad argument @ 'createAnimation' [expected function at argument 4, got "..type(duration).."]") 
    assert(type(onChange) == "function", "Bad argument @ 'createAnimation' [expected function at argument 5, got "..type(onChange).."]") 
    return table.insert(anims, {from = f, to = t, easing = table.find(builtins, easing) and easing or builtins[easing], duration = duration, start = getTickCount( ), onChange = onChange}) 
end 
  
addEventHandler("onClientRender", root, function( ) 
    local now = getTickCount( ) 
    for k,v in ipairs(anims) do 
        if now >= v.start+v.duration then 
            table.remove(anims, k) 
        end 
        v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing)) 
    end 
end) 

Example :

--Slide Animation
local sx, sy = guiGetScreenSize( )
local window = guiCreateWindow((sx-300)/2, (sy-400)/2, 300, 400, "Test", false)
guiSetVisible(window, false)
bindKey("f2", "down", function( )
    if anim then return end
    local v = guiGetVisible(window)
    if not v then guiSetVisible(window, true) end
    anim = true
    createAnimation(v and 400 or 0, v and 0 or 400, 2, 1250, function(height)
        if v and height == 0 then
            guiSetVisible(window, false)
            anim = false
        elseif not v and height == 400 then
            anim = false
        end
        local w, h = guiGetSize(window, false)
        guiSetSize(window, w, height, false)
    end)
end) 

ولاتنسوني من صالح دعائكم :(

والسلام عليكم ورحمة الله وبركاته :D

Link to comment

تحريك اللوحة , يمكن هاذا سهل لـك

الطلب الاول

بسم الله الرحمن الرحيم

Client gui library

لتحريك الواجهه من فوق لـ الوسط استخدم الكود هذا

  
TimeGuiSetTopC = { } 
  
function guiMoveTopToCenter(gui) 
if getElementData(gui,"HelhGui") == false then 
    setElementData(gui,"HelhGui",true) 
    local s1,s2=guiGetScreenSize() 
    local w1,w2=guiGetSize(gui,false) 
    local x,y = (s1-w1)/2,(s2-w2)/2 
    guiSetPosition(gui,x,-w2,false)  
  
TimeGuiSetTopC[gui] = setTimer(guiMoveTopToCenter,50,0,gui) 
end 
    local a,b=guiGetScreenSize() 
    local w1,w2=guiGetSize(gui,false) 
    local x,y = (a-w1)/2,(b-w2)/2 
    local x1,y1 = guiGetPosition ( gui, false) 
if (y1 >= y) then 
    killTimer(TimeGuiSetTopC[gui]) 
    setElementData(gui,"HelhGui",false) 
    else 
    guiSetPosition(gui,x1,(y1+10),false) 
end 
end 
  
  

لتحريك الواجهه لـ اليمين لـ الوسط استخدم الكود هذا

  
  
TimeGuiSetRightC = { } 
  
function guiMoveRightToCenter(gui) 
if getElementData(gui,"HelhGui") == false then 
    setElementData(gui,"HelhGui",true) 
    local s1,s2=guiGetScreenSize() 
    local w1,w2=guiGetSize(gui,false) 
    local x,y = (s1-w1)/2,(s2-w2)/2 
    guiSetPosition(gui,-x,y,false)  
  
TimeGuiSetRightC[gui] = setTimer(guiMoveRightToCenter,50,0,gui) 
end 
    local a,b=guiGetScreenSize() 
    local w1,w2=guiGetSize(gui,false) 
    local x,y = (a-w1)/2,(b-w2)/2 
    local x1,y1 = guiGetPosition ( gui, false) 
if (x1 >= x) then 
    killTimer(TimeGuiSetRightC[gui]) 
    setElementData(gui,"HelhGui",false) 
    else 
    guiSetPosition(gui,x1+10,y,false) 
end 
end 
  

لتحريك الواجهه من تحت لـ الوسط استخدم الكود هذا

  
TimeGuiSetDownC = { } 
  
  
function guiMoveDownToCenter(gui) 
if getElementData(gui,"HelhGui") == false then 
    setElementData(gui,"HelhGui",true) 
    local s1,s2=guiGetScreenSize() 
    local w1,w2=guiGetSize(gui,false) 
    local x,y = (s1-w1)/2,(s2-w2)/2 
    guiSetPosition(gui,x,(w2*4),false)  
  
TimeGuiSetDownC[gui] = setTimer(guiMoveDownToCenter,50,0,gui) 
end 
    local a,b=guiGetScreenSize() 
    local w1,w2=guiGetSize(gui,false) 
    local x,y = (a-w1)/2,(b-w2)/2 
    local x1,y1 = guiGetPosition ( gui, false) 
if (y1 <= y) then 
    killTimer(TimeGuiSetDownC[gui]) 
    setElementData(gui,"HelhGui",false) 
    else 
    guiSetPosition(gui,x1,(y1-10),false) 
end 
end 
  
  

لتحريك الواجهه لليسار لـ الوسط استخدم الكود هذا

  
TimeGuiSetLeftC = { } 
  
  
function guiMoveLeftToCenter(gui) 
if getElementData(gui,"HelhGui") == false then 
    setElementData(gui,"HelhGui",true) 
    local s1,s2=guiGetScreenSize() 
    local w1,w2=guiGetSize(gui,false) 
    local x,y = (s1-w1)/2,(s2-w2)/2 
    guiSetPosition(gui,(w1*4),(y),false)  
  
TimeGuiSetLeftC[gui] = setTimer(guiMoveLeftToCenter,50,0,gui) 
end 
    local a,b=guiGetScreenSize() 
    local w1,w2=guiGetSize(gui,false) 
    local x,y = (a-w1)/2,(b-w2)/2 
    local x1,y1 = guiGetPosition ( gui, false) 
if (x1 <= x) then 
    killTimer(TimeGuiSetLeftC[gui]) 
    setElementData(gui,"HelhGui",false) 
    else 
    guiSetPosition(gui,(x1-10),y1,false) 
end 
end 
  
  

-----------------------------------------------------

مثآل

  
TimeGuiSetLeftC = { } 
  
  
function guiMoveLeftToCenter(gui) 
if getElementData(gui,"HelhGui") == false then 
    setElementData(gui,"HelhGui",true) 
    local s1,s2=guiGetScreenSize() 
    local w1,w2=guiGetSize(gui,false) 
    local x,y = (s1-w1)/2,(s2-w2)/2 
    guiSetPosition(gui,(w1*4),(y),false)  
  
TimeGuiSetLeftC[gui] = setTimer(guiMoveLeftToCenter,50,0,gui) 
end 
    local a,b=guiGetScreenSize() 
    local w1,w2=guiGetSize(gui,false) 
    local x,y = (a-w1)/2,(b-w2)/2 
    local x1,y1 = guiGetPosition ( gui, false) 
if (x1 <= x) then 
    killTimer(TimeGuiSetLeftC[gui]) 
    setElementData(gui,"HelhGui",false) 
    else 
    guiSetPosition(gui,(x1-10),y1,false) 
end 
end 
  
  
  
  
addEventHandler( "onClientResourceStart",resourceRoot, 
    function ( startedRes ) 
    myWindow = guiCreateWindow ( 0, 0, 0.3, 0.3, "Booo", true ) 
    myLabel = guiCreateLabel  ( 0.2,0.2,0.3, 0.3, "u Love Me ?",true,myWindow) 
        guiMoveLeftToCenter(myWindow) 
end 
) 
  

---- يجيب الاعبين الي بالعالم الوهمي تفضل سويته لك

function GetPlayerInDim ( TheDim ) 
local ThePlayers = { } 
if ( type ( TheDim ) ~= "number" ) then  
return false  
end 
for Index,Players in ipairs ( getElementsByType ( "player" ) ) do 
if ( getElementDimension ( Players ) == TheDim ) then  
table["insert"] ( ThePlayers , Players ) 
end 
end 
return ThePlayers 
end 
  
  
-- Ex# 
  
for i,v in ipairs ( GetPlayerInDim ( 5 ) ) do  
outputChatBox ( getPlayerName ( v ) ) 
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...