Jump to content

وش الي احتاجه


Mbtdaa

Recommended Posts

  
addEventHandler("onClientGUIClick",root, 
    function() 
        if source == theImage then 
            guiSetVisible ( theWindow , true ) 
        end 
    end 
) 
  

وش الي كل شوية

if source ==

مو لازم .. فيه طريقة سهلة وبسيطة بس تنفع فقط على 1 زر

addEventHandler("onClientGUIClick",theImage, 
function() 
   guiSetVisible ( theWindow , true ) 
end) 
  

الحين عفيت نفسك من اند زايدة

حاول تخلي كودك صغير مو كبير .. هذي هي الطريقة ..

فيه ناس تسوي ايفنت ووظيفة زايدة على كل شي صغير يسوونه

وفيه ناس تسوي زي كذا

function name() 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
addEventHandler 

فوارق ما لها داعي

المبرمج الذكي هو الي يحاول يخلي كوده صغير مو كبير.

Link to comment
  
addEventHandler("onClientGUIClick",root, 
    function() 
        if source == theImage then 
            guiSetVisible ( theWindow , true ) 
        end 
    end 
) 
  

اول شي يعطيك العافيه على الرد

وثاني شي انا بصراحه مافهمت الكود ><

يعني هو يظهر لي نافذة ولا وش بظبط

ولو هو يظهر لي نافذه

موب لازم يكون فيها مقاسات وكذا لاني مني شايف مكان احط فيه المقاسات والاحداثيات

..

Link to comment
  
addEventHandler("onClientGUIClick",root, 
    function() 
        if source == theImage then 
            guiSetVisible ( theWindow , true ) 
        end 
    end 
) 
  

اول شي يعطيك العافيه على الرد

وثاني شي انا بصراحه مافهمت الكود ><

يعني هو يظهر لي نافذة ولا وش بظبط

ولو هو يظهر لي نافذه

موب لازم يكون فيها مقاسات وكذا لاني مني شايف مكان احط فيه المقاسات والاحداثيات

..

حط اسم الصورة حقتك بدال

theImage

وحط اسم النافذة حقتك بدال

theWindow

Link to comment
وش الي كل شوية

if source ==

مو لازم .. فيه طريقة سهلة وبسيطة بس تنفع فقط على 1 زر

addEventHandler("onClientGUIClick",theImage, 
function() 
   guiSetVisible ( theWindow , true ) 
end) 

فوارق ما لها داعي

المبرمج الذكي هو الي يحاول يخلي كوده صغير مو كبير.

theImage الححين اي شيء تضغطه له علاقة بـ

مثل النافذة اللي حول الصورة او التاب

راح تبدأ الوظيفة اللي تبعها

:roll:

Link to comment
وش الي كل شوية

if source ==

مو لازم .. فيه طريقة سهلة وبسيطة بس تنفع فقط على 1 زر

addEventHandler("onClientGUIClick",theImage, 
function() 
   guiSetVisible ( theWindow , true ) 
end) 

فوارق ما لها داعي

المبرمج الذكي هو الي يحاول يخلي كوده صغير مو كبير.

خخخخ نوب ..

theImage الححين اي شيء تضغطه له علاقة بـ

راح تبدأ الوظيفة اللي تبعها =]

انا مسوي في كل كودات كذا ويعني مثلاً خلاص عشان عرفت

if ( source == guiElement ) then

نطبقها على كل كوداتنا ؟

ووش الي اي شي تضغطه له علاقة بـ

Image

راح تبداء الوظيفة الي بعدها

لا فالح

image

هو مكان الزر بدال ما نسوي

guiCreateButton

Link to comment

طيب انا مجربها بعد وما صار الي تقول عليه ...

وشوف المثال الأول حق الويكي

-- When client's resource starts, create the GUI 
function initGUI( ) 
    -- Create our button 
    btnOutput = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) 
  
    -- And attach our button to the outputEditBox function 
    addEventHandler ( "onClientGUIClick", btnOutput, outputEditBox, false ) 
  
    -- Create an edit box and define it as "editBox". 
    editBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, "Type your message here!", true ) 
    guiEditSetMaxLength ( editBox, 128 ) -- The max chatbox text length is 128, so force this 
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), initGUI ) 
  
-- Setup our function to output the message to the chatbox 
function outputEditBox ( button ) 
    if button == "left" then 
        local text = guiGetText ( editBox )-- Get the text from the edit box 
        outputChatBox ( text ) -- Output that text 
    end 
end 

Link to comment
عناد جربت كودك وماصار شي

......

أنت تبي تسوي صوره وعند الضغت عليها يصير شي صح ؟

والصوره ذي بدال الزر

addEventHandler("onClientGUIClick", image, 
function( ) 
  outputChatBox("هلا") 
end) 

هذا راح يطلع كلمة " هلا " عند الضغت على هالصورة

غير

image

بـ اسم الصورة المعرف عندك

يارب تكون فهمتني

Link to comment
انا مجربها ..

مثلاً سويت صورة بـ وسط نافذة ..

و حطيت كودك ذا

واضغط على النافذة تبدأ الوظيفة

يعني الصورة سواء ضغطت عليها أو لا ماتفرق

if ( source ==

تنفع عند الضغت على عدة أزرار

مثلاً

سوينا زر

button1 = guiCreateButton( .. ) 
button2 = guiCreateButton( .. ) 
  
addEventHandler("onClientGUIClick", root, 
function( ) 
  if ( source == button1 ) then 
    -- your code 
  elseif ( source == button2 ) then 
    -- your code 
  end 
end) 

Link to comment
if ( source ==

تنفع عند الضغت على عدة أزرار

مثلاً

سوينا زر

button1 = guiCreateButton( .. ) 
button2 = guiCreateButton( .. ) 
  
addEventHandler("onClientGUIClick", root, 
function( ) 
  if ( source == button1 ) then 
    -- your code 
  elseif ( source == button2 ) then 
    -- your code 
  end 
end) 

جربت كودكـ لعدة مرات و النتيجة = أضغط اي شيء تبدأ الوظيفة مو شرط الصورة هذي =]

Link to comment
if ( source ==

تنفع عند الضغت على عدة أزرار

مثلاً

سوينا زر

button1 = guiCreateButton( .. ) 
button2 = guiCreateButton( .. ) 
  
addEventHandler("onClientGUIClick", root, 
function( ) 
  if ( source == button1 ) then 
    -- your code 
  elseif ( source == button2 ) then 
    -- your code 
  end 
end) 

جربت كودكـ لعدة مرات و النتيجة = أضغط اي شيء تبدأ الوظيفة مو شرط الصورة هذي =]

وشوف المثال الأول حق الويكي

-- When client's resource starts, create the GUI 
function initGUI( ) 
    -- Create our button 
    btnOutput = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) 
  
    -- And attach our button to the outputEditBox function 
    addEventHandler ( "onClientGUIClick", btnOutput, outputEditBox, false ) 
  
    -- Create an edit box and define it as "editBox". 
    editBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, "Type your message here!", true ) 
    guiEditSetMaxLength ( editBox, 128 ) -- The max chatbox text length is 128, so force this 
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), initGUI ) 
  
-- Setup our function to output the message to the chatbox 
function outputEditBox ( button ) 
    if button == "left" then 
        local text = guiGetText ( editBox )-- Get the text from the edit box 
        outputChatBox ( text ) -- Output that text 
    end 
end 

Link to comment

:mrgreen: اخوي عناد، طريقة تيتي عمر هي الافضل، وهذي الي انا اتبعها لجيت اسوي المودات

وليست if source ==

خخخخخخخخخخخخ

لكن ايظا كلامك فيه نوع من الصحة، بحيث انه لو ضغطت اي شي تابع للصورة راح يشتغل الايفينت

لكن تيتي عمر لا يعلم او ربما نسى يقولك انه لابطال الشي ذا

لازم تحط false

في الاخير

مثل ذا

addEventHandler ( "onClientGUIClick", btnOutput, outputEditBox, false )

جربها بنفس الطريقة ورد لي خبر :mrgreen:

Link to comment

هذآ اللي كنت أقصده وهو مو فآهمني =]

أن أي شيء تآبع لها ينضغط ..

false وأنا عارف أن هي الأسسهل لككن هو مآقال حط بـ الأخير

بكـذآ صآحب الموضوع رآح يخرب سكربته =]

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