Jump to content

إذا ضغط أف1 يجي صوت وتجي صوره ولاكن ...


Recommended Posts

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

ابي كود إذا ضغطت أف 1 يجي صوت وإذا ضغطه مره ثانيه يروح الصوت ..

وأبي بنفس الوقت تجي صوره في اللوحه تختفي وترجع تختفي وترجع بلا نهايه ..

وهذا كود أنا مسويه :/

وهذا كود مدري صح ولا غلط :/

function onresourceStart () 
    bindKey ("F1", "down", showUserPanel) 
    Playsound("sound.wav") 
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) 
  
function showUserPanel () 
local getVisible = guiGetVisible (windows) 
if (getVisible) then 
    guiSetVisible (windows, false) 
    showCursor (false) 
else 
    guiSetVisible (windows, true) 
    showCursor (true) 
    visble() 
    Slaysound("sound.wav") 
    end 
end 

وحقت الصور ماعرفت لها

إلا في اوقات معينه أعرف

بس بلا نهايه تختفي وتظهر

ماأعرف ^

:roll:

Link to comment
مافهمتك بس شوف وش اللي وصل لي

تضغط اف 1 يجي صوت وصورة ..

تضغطة مرة ثانية يروح الصوت و الصورة

وكذآ صح؟

أول ماتضغط أف1 مع اللوحه طبعاً تكون

تجي الصوره في اللوحه

وتختفي وتظهر وتختفي وتظهر وكذا ..

وصوت يجي

إذا ضغط أف 1 يختفي الصوت .. وطبعاً أكيد الصوره راح تختفي مع اللوحه :)

Link to comment
تبي الصوت يجي مع الصورة ؟

# Client Side

bindKey( "f1", "down", 
function () 
    guiSetVisible (img, true) 
    playSound("sound.wav") 
    else 
    guiSetVisible(img, false) 
    stopSound("sound.wav") 
    end 
end)     

؟ if بدون أداة الشرط else كيف تستخدم

Link to comment
-- # Client Side .. 
bindKey ( 'F1','down', 
    function (      ) 
        if not guiGetVisible ( windows ) and not aSound then 
            guiSetVisible ( windows,true ); 
            aSound = playSound ( 'sound.wav' ); 
        else 
            guiSetVisible ( windows,false ); 
            destroyElement ( aSound ); 
            aSound = nil; 
    end; 
end 
); 

لم يتم التجربة ..

Link to comment
تبي الصوت يجي مع الصورة ؟

# Client Side

bindKey( "f1", "down", 
function () 
    guiSetVisible (img, true) 
    playSound("sound.wav") 
    else 
    guiSetVisible(img, false) 
    stopSound("sound.wav") 
    end 
end)     

؟ if بدون أداة الشرط else كيف تستخدم

نسيت ذذ

أسوي تحقق من اللاعب ولأ؟

Link to comment
-- # Client Side .. 
bindKey ( 'F1','down', 
    function (      ) 
        if not guiGetVisible ( windows ) and not aSound then 
            guiSetVisible ( windows,true ); 
            aSound = playSound ( 'sound.wav' ); 
        else 
            guiSetVisible ( windows,false ); 
            destroyElement ( aSound ); 
            aSound = nil; 
    end; 
end 
); 

لم يتم التجربة ..

ليه ما تختصر أحسن؟

bindKey ( 'F1','down', 
    function (      ) 
        if not guiGetVisible ( windows ) and not aSound then 
            guiSetVisible ( windows,true ); 
            playSound ( 'sound.wav' ); 
        else 
            guiSetVisible ( windows,false ); 
            stopSound ( 'sound.wav' ); 
    end; 
end 
); 
  
Link to comment
-- # Client Side .. 
bindKey ( 'F1','down', 
    function (      ) 
        if not guiGetVisible ( windows ) and not aSound then 
            guiSetVisible ( windows,true ); 
            aSound = playSound ( 'sound.wav' ); 
        else 
            guiSetVisible ( windows,false ); 
            destroyElement ( aSound ); 
            aSound = nil; 
    end; 
end 
); 

لم يتم التجربة ..

ليه ما تختصر أحسن؟

bindKey ( 'F1','down', 
    function (      ) 
        if not guiGetVisible ( windows ) and not aSound then 
            guiSetVisible ( windows,true ); 
            playSound ( 'sound.wav' ); 
        else 
            guiSetVisible ( windows,false ); 
            stopSound ( 'sound.wav' ); 
    end; 
end 
); 
  

بس غيرت الفنكشن و شلت النيل صار اختصار .. ؟ يعيني بسس

Link to comment
-- # Client Side .. 
bindKey ( 'F1','down', 
    function (      ) 
        if not guiGetVisible ( windows ) and not aSound then 
            guiSetVisible ( windows,true ); 
            aSound = playSound ( 'sound.wav' ); 
        else 
            guiSetVisible ( windows,false ); 
            destroyElement ( aSound ); 
            aSound = nil; 
    end; 
end 
); 

لم يتم التجربة ..

انا أبي

لمن تضغط

زر أف 1

تجي صوره في لوحه

تختفي وتروح

ورا بعض

مثل

سبحان الله.png

وتجي بعدها

والحمد لله.png

وبعدين تصير كذا بأستمرار

سبحان الله.png

والحمد لله.png

سبحان الله.png

والحمد لله.png

سبحان الله.png

والحمد لله.png

سبحان الله.png

والحمد لله.png

سبحان الله.png

والحمد لله.png

سبحان الله.png

والحمد لله.png

سبحان الله.png

والحمد لله.png

سبحان الله.png

والحمد لله.png

.. فهمت قصدي ؟

Link to comment

لم يتم التجربة ..

Images = {  
    "سبحان الله"; 
    "والحمد لله"; 
        -- " اسم ملف الصورة بدون الصيغة " 
}; 
  
showImage = function ( value ) 
    if value then 
        local image = value..".png" 
        guiStaticImageLoadImage ( Image, image ) 
    end 
end 
  
Image = guiCreateImage ( ........ ) 
setTimer ( showImage, 5000, 0, Images [ math.random ( #Images ) ] ) 

Link to comment
-- # Client Side .. 
bindKey ( 'F1','down', 
    function (      ) 
        if not guiGetVisible ( windows ) and not aSound then 
            guiSetVisible ( windows,true ); 
            aSound = playSound ( 'sound.wav' ); 
        else 
            guiSetVisible ( windows,false ); 
            destroyElement ( aSound ); 
            aSound = nil; 
    end; 
end 
); 

لم يتم التجربة ..

ليه ما تختصر أحسن؟

bindKey ( 'F1','down', 
    function (      ) 
        if not guiGetVisible ( windows ) and not aSound then 
            guiSetVisible ( windows,true ); 
            playSound ( 'sound.wav' ); 
        else 
            guiSetVisible ( windows,false ); 
            stopSound ( 'sound.wav' ); 
    end; 
end 
); 
  

سويت شيء جديد ؟

+

كودك غلط

Syntax :

bool stopSound ( element theSound )  

Example :

Moderator = playSound(........) 
stopSound(Moderator) 

Link to comment
لم يتم التجربة ..
Images = {  
    "سبحان الله"; 
    "والحمد لله"; 
        -- " اسم ملف الصورة بدون الصيغة " 
}; 
  
showImage = function ( value ) 
    if value then 
        local image = value..".png" 
        guiStaticImageLoadImage ( Image, image ) 
    end 
end 
  
Image = guiCreateImage ( ........ ) 
setTimer ( showImage, 5000, 0, Images [ math.random ( #Images ) ] ) 

guiCreateImage = ?

guiCreateStaticImage -_-"

Link to comment
لم يتم التجربة ..
Images = {  
    "سبحان الله"; 
    "والحمد لله"; 
        -- " اسم ملف الصورة بدون الصيغة " 
}; 
  
showImage = function ( value ) 
    if value then 
        local image = value..".png" 
        guiStaticImageLoadImage ( Image, image ) 
    end 
end 
  
Image = guiCreateImage ( ........ ) 
setTimer ( showImage, 5000, 0, Images [ math.random ( #Images ) ] ) 

مايشتغل :/

Link to comment
لم يتم التجربة ..
Images = {  
    "سبحان الله"; 
    "والحمد لله"; 
        -- " اسم ملف الصورة بدون الصيغة " 
}; 
  
showImage = function ( value ) 
    if value then 
        local image = value..".png" 
        guiStaticImageLoadImage ( Image, image ) 
    end 
end 
  
Image = guiCreateImage ( ........ ) 
setTimer ( showImage, 5000, 0, Images [ math.random ( #Images ) ] ) 

مايشتغل :/

اطرح الي سويته

Link to comment
لم يتم التجربة ..
Images = {  
    "سبحان الله"; 
    "والحمد لله"; 
        -- " اسم ملف الصورة بدون الصيغة " 
}; 
  
showImage = function ( value ) 
    if value then 
        local image = value..".png" 
        guiStaticImageLoadImage ( Image, image ) 
    end 
end 
  
Image = guiCreateImage ( ........ ) 
setTimer ( showImage, 5000, 0, Images [ math.random ( #Images ) ] ) 

مايشتغل :/

اطرح الي سويته

حق عناد

Link to comment
مممم ابو فيصل انا اللي فهمته انك تبى لمى يضغط اف1 اول مره يجي صوت

ولمى يضغط مره ثانيه ما يجي صوت صح..؟

لا

ابي لمن يضغط زر أف 1

يجي صوره

والصوره تتحدث كل ثانيه

يعني هي صورتين

تجي صوره وبعدها بثانيه صوره

وماتوقف ..

:)

Link to comment
مممم ابو فيصل انا اللي فهمته انك تبى لمى يضغط اف1 اول مره يجي صوت

ولمى يضغط مره ثانيه ما يجي صوت صح..؟

لا

ابي لمن يضغط زر أف 1

يجي صوره

والصوره تتحدث كل ثانيه

يعني هي صورتين

تجي صوره وبعدها بثانيه صوره

وماتوقف ..

:)

اهاا يعني انت تباه كنها لوحة اعلانات صح..؟

Link to comment
مممم ابو فيصل انا اللي فهمته انك تبى لمى يضغط اف1 اول مره يجي صوت

ولمى يضغط مره ثانيه ما يجي صوت صح..؟

لا

ابي لمن يضغط زر أف 1

يجي صوره

والصوره تتحدث كل ثانيه

يعني هي صورتين

تجي صوره وبعدها بثانيه صوره

وماتوقف ..

:)

اهاا يعني انت تباه كنها لوحة اعلانات صح..؟

Edit:

اوكي سهلة كل اللي تحتاجه انك تسوي وقت

false لمى يخلص يحط الصورة الاول

true والصورة الثانيه

false وقت ثاني لمى يخلص يحط الثانيه

true والاولى

Edit:

true او انك تسوي تحقق اذا كانت الصورة الاولى

false اذا يحط الاولى

true والثانية

else

true اذا كانت الثانية

false يحط الثانية

true والاولى

ويتكرر الموضوع على كذا

بس...

Link to comment
local images = { "1.png","2.png" }; 
local Time = 5000; 
local lastTick = getTickCount ( ); 
local img = 1; 
  
function Handler( ) 
        local curTick = getTickCount ( ); 
        if ( curTick - lastTick > Time ) then 
            img = ( img >= #images and 1 or img + 1 ); 
            guiStaticImageLoadImage ( windows, images [ img ] ); 
            lastTick = curTick; 
        end; 
    end; 
  
bindKey ( 'F1','down', 
    function (  ) 
        if not guiGetVisible ( windows ) and not aSound then 
            guiSetVisible ( windows,true ); 
            addEventHandler ( "onClientRender", root,Handler ); 
            aSound = playSound ( 'sound.wav',true ); 
        else 
            guiSetVisible ( windows,false ); 
            removeEventHandler ( "onClientRender", root,Handler ); 
            destroyElement ( aSound ); 
            aSound = nil; 
        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...