Jump to content

طلب تصحيح الاكواد


Recommended Posts

السلام عليكم

ابي طلب بسيط

وهو انكم اتشوفو وش الخطأ في دا الكود

addEventHandler("onClientRender", root, 
    function() 
        dxDrawRectangle(708, 243, 81, 26, tocolor(0, 0, 0, 255), true) 
        dxDrawRectangle(709, 244, 79, 24, tocolor(185, 185, 185, 255), true) 
    end 
) 
  
addEventHandler("onClientMouseEnter", root, 
    function(709, 244) 
    dxDrawRectangle(709, 244, 79, 24, tocolor(0, 0, 0, 255), true) 
    end 
)    
  

شرح الاكواد :

.الاكواد دي تصنع شكل اذا مر فوقة الماوس يتغير لونة.

انا في انتظار ردودكم :mrgreen::mrgreen:

Link to comment

R,G,B = 185,185,185 
R = guiCreateButton(709,244,79,24,"",false) 
guiSetAlpha(R,0) 
addEventHandler("onClientMouseEnter",R,onEnter) 
addEventHandler("onClientMouseLeave",R,onLeave) 
   
function Draw () 
    dxDrawRectangle(709,244,79,24,tocolor(R,G,B,255),true) 
end 
addEventHandler ("onClientRender",getRootElement(),Draw) 
      
function onEnter() 
    R,G,B = 255,0,255 
end 
function onLeave() 
    R,G,B = 185,185,185 
end 

الطريقة ذي اسهل وتتيح لك طرق اسهل واكثر للاستخدام

.

Link to comment
R,G,B = 185,185,185 
R = guiCreateButton(709,244,79,24,"",false) 
guiSetAlpha(R,0) 
addEventHandler("onClientMouseEnter",R,onEnter) 
addEventHandler("onClientMouseLeave",R,onLeave) 
   
function Draw () 
    dxDrawRectangle(709,244,79,24,tocolor(R,G,B,255),true) 
end 
addEventHandler ("onClientRender",getRootElement(),Draw) 
      
function onEnter() 
    R,G,B = 255,0,255 
end 
function onLeave() 
    R,G,B = 185,185,185 
end 

الطريقة ذي اسهل وتتيح لك طرق اسهل واكثر للاستخدام

.

الاكواد مش شغالة

الزر يطلع بس مايتغير لونة

Link to comment
R = guiCreateButton(709,244,79,24,"", false) 
    guiSetAlpha(R,0) 
addEventHandler("onClientMouseEnter", root, 
function() 
guiSetProperty(R,"NormalTextColour", "FF0000") 
end 
) 
  
addEventHandler("onClientMouseLeave", root,  
function() 
guiSetProperty(R,"NormalTextColour", "FFFFFF") 
end 
) 
  

Link to comment
R,G,B = 185,185,185 
R = guiCreateButton(709,244,79,24,"",false) 
guiSetAlpha(R,0) 
addEventHandler("onClientMouseEnter",R,onEnter) 
addEventHandler("onClientMouseLeave",R,onLeave) 
   
function Draw () 
    dxDrawRectangle(709,244,79,24,tocolor(R,G,B,255),true) 
end 
addEventHandler ("onClientRender",getRootElement(),Draw) 
      
function onEnter() 
    R,G,B = 255,0,255 
end 
function onLeave() 
    R,G,B = 185,185,185 
end 

الطريقة ذي اسهل وتتيح لك طرق اسهل واكثر للاستخدام

.

الاكواد مش شغالة

الزر يطلع بس مايتغير لونة

-_-"

الكود شغال

شوف وش يطلع لك بالديبوق

Link to comment
R,G,B = 185,185,185 
R = guiCreateButton(709,244,79,24,"",false) 
guiSetAlpha(R,0) 
addEventHandler("onClientMouseEnter",R,onEnter) 
addEventHandler("onClientMouseLeave",R,onLeave) 
   
function Draw () 
    dxDrawRectangle(709,244,79,24,tocolor(R,G,B,255),true) 
end 
addEventHandler ("onClientRender",getRootElement(),Draw) 
      
function onEnter() 
    R,G,B = 255,0,255 
end 
function onLeave() 
    R,G,B = 185,185,185 
end 

الطريقة ذي اسهل وتتيح لك طرق اسهل واكثر للاستخدام

.

الاكواد مش شغالة

الزر يطلع بس مايتغير لونة

-_-"

الكود شغال

شوف وش يطلع لك بالديبوق

جربته انت؟

Link to comment

لول معليش مانتبهت للايفنات

هاذا شغال

  
R,G,B = 185,185,185 
R = guiCreateButton(709,244,79,24,"",false) 
guiSetAlpha(R,0) 
   
function Draw () 
    dxDrawRectangle(709,244,79,24,tocolor(R,G,B,255),true) 
end 
addEventHandler ("onClientRender",getRootElement(),Draw) 
      
function onEnter() 
    R,G,B = 255,0,255 
end 
addEventHandler("onClientMouseEnter",R,onEnter) 
  
function onLeave() 
    R,G,B = 185,185,185 
end 
addEventHandler("onClientMouseLeave",R,onLeave) 

Link to comment
R = guiCreateButton(709,244,79,24,"", false) 
    guiSetAlpha(R,0) 
addEventHandler("onClientMouseEnter", root, 
function() 
guiSetProperty(R,"NormalTextColour", "FF0000") 
end 
) 
  
addEventHandler("onClientMouseLeave", root,  
function() 
guiSetProperty(R,"NormalTextColour", "FFFFFF") 
end 
) 
  

Link to comment
لول معليش مانتبهت للايفنات

هاذا شغال

  
R,G,B = 185,185,185 
R = guiCreateButton(709,244,79,24,"",false) 
guiSetAlpha(R,0) 
   
function Draw () 
    dxDrawRectangle(709,244,79,24,tocolor(R,G,B,255),true) 
end 
addEventHandler ("onClientRender",getRootElement(),Draw) 
      
function onEnter() 
    R,G,B = 255,0,255 
end 
addEventHandler("onClientMouseEnter",R,onEnter) 
  
function onLeave() 
    R,G,B = 185,185,185 
end 
addEventHandler("onClientMouseLeave",R,onLeave) 

مشكوووور لكل الي شاركو

واسف على الازعاج الي سببتو

لاكن الاكواد الاولة مشتغلة عندي مدري ليه لاكن دي الاكواد اشتغلة

يعطيكم العافية

ماشاء الله الاستجابة سريعة لدرجة اني ماقدرة الحق ارد عليكم :mrgreen::lol:

Link to comment
لول معليش مانتبهت للايفنات

هاذا شغال

  
R,G,B = 185,185,185 
R = guiCreateButton(709,244,79,24,"",false) 
guiSetAlpha(R,0) 
   
function Draw () 
    dxDrawRectangle(709,244,79,24,tocolor(R,G,B,255),true) 
end 
addEventHandler ("onClientRender",getRootElement(),Draw) 
      
function onEnter() 
    R,G,B = 255,0,255 
end 
addEventHandler("onClientMouseEnter",R,onEnter) 
  
function onLeave() 
    R,G,B = 185,185,185 
end 
addEventHandler("onClientMouseLeave",R,onLeave) 

مشكوووور لكل الي شاركو

واسف على الازعاج الي سببتو

لاكن الاكواد الاولة مشتغلة عندي مدري ليه لاكن دي الاكواد اشتغلة

يعطيكم العافية

ماشاء الله الاستجابة سريعة لدرجة اني ماقدرة الحق ارد عليكم :mrgreen::lol:

اخر كود عطيتك اياه مجربه قبل مانزلته لك

شغله وافتح الديبوق وقلي وش يجيك

Link to comment

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

  
R = guiCreateButton(709,244,79,24,"",false) --الزر الاول 
guiSetAlpha(R,0) 
  
f = guiCreateButton(709,244,79,24,"",false) --الزر الثاني 
guiSetAlpha(R,0) 
  
function Draw () 
    dxDrawRectangle(709,244,79,24,tocolor(R,G,B,255),true)  --الزر الاول 
    dxDrawRectangle(709,244,79,24,tocolor(Ra,Ga,Ba,255),true) --الزر الثاني 
end 
addEventHandler ("onClientRender",getRootElement(),Draw) 
      
function onEnter() --الزر الاول 
    R,G,B = 0,0,0 
end 
addEventHandler("onClientMouseEnter",R,onEnter) 
  
function onLeave() --الزر الاول 
    R,G,B = 185,185,185 
end 
addEventHandler("onClientMouseLeave",R,onLeave) 
  
function onEnter_1() --الزر الثاني 
    Ra,Ga,Ba = 0,0,0 
end 
addEventHandler("onClientMouseEnter",f,onEnter_1) 
  
function onLeave_1() --الزر الثاني 
    Ra,Ga,Ba = 185,185,185 
end 
addEventHandler("onClientMouseLeave",f,onLeave_1) 

Link to comment

ما يحتاج تستخدمون لبل مخفي ومدري وش

بالنسبة للزرين .. سوي زي بالجدول وسوي زي الطريقة ذذ ومسوي لك ريتنكقل ثاني ويمديكـ تضيف

local sX, sY = guiGetScreenSize(   ); 
local colors = { 
   [ "Rectangle" ] = { 255, 255, 255, 255 }, 
   [ "Rectangle2" ] = { 255, 255, 255, 255 }, 
}    
  
addEventHandler ( "onClientRender", root, function(    ) 
  dxDrawRectangle( 709, 244, 79, 24, tocolor(colors[ "Rectangle" ][1],colors[ "Rectangle" ][2],colors[ "Rectangle" ][3],colors[ "Rectangle" ][4]),true ) 
   if ( isCursorShowing(   ) == true ) then   
       local cx, cy = getCursorPosition(      ) 
       if ( cx*sX >= 709 and cx*sX <= 709+79 and cy*sY >= 244 and cy*sY <= 244+24 ) then 
            colors[ "Rectangle" ][1] = 255 
            colors[ "Rectangle" ][2] = 0 
            colors[ "Rectangle" ][3] = 100 
            colors[ "Rectangle" ][4] = 255 
        else 
            colors[ "Rectangle" ][1] = 255 
            colors[ "Rectangle" ][2] = 255 
            colors[ "Rectangle" ][3] = 255 
            colors[ "Rectangle" ][4] = 255   
         end 
     end 
end ) 
Edited by Guest
Link to comment
ما يحتاج تستخدمون لبل مخفي ومدري وش

بالنسبة للزرين .. سوي زي بالجدول وسوي زي الطريقة ذذ ومسوي لك ريتنكقل ثاني ويمديكـ تضيف

local sX, sY = guiGetScreenSize(   ); 
local colors = { 
   [ "Rectangle" ] = { 255, 255, 255, 255 } 
   [ "Rectangle2" ] = { 255, 255, 255, 255 } 
}    
  
addEventHandler ( "onClientRender", root, function(    ) 
  dxDrawRectangle( 709, 244, 79, 24, tocolor(colors[ "Rectangle" ][1],colors[ "Rectangle" ][2],colors[ "Rectangle" ][3],colors[ "Rectangle" ][4]),true ) 
   if ( isCursorShowing(   ) == true ) then   
       local cx, cy = getCursorPosition(      ) 
       if ( cx*sX >= 709 and cx*sX <= 709+79 and cy*sY >= 244 and cy*sY <= 244+24 ) then 
            colors[ "Rectangle" ][1] = 255 
            colors[ "Rectangle" ][2] = 0 
            colors[ "Rectangle" ][3] = 100 
            colors[ "Rectangle" ][4] = 255 
        else 
            colors[ "Rectangle" ][1] = 255 
            colors[ "Rectangle" ][2] = 255 
            colors[ "Rectangle" ][3] = 255 
            colors[ "Rectangle" ][4] = 255   
         end 
     end 
end ) 

مشكووور

لاكن هل دي الكواد كاملة او شغالة لأنها مااشتغلة عندي

Link to comment
ما يحتاج تستخدمون لبل مخفي ومدري وش

بالنسبة للزرين .. سوي زي بالجدول وسوي زي الطريقة ذذ ومسوي لك ريتنكقل ثاني ويمديكـ تضيف

local sX, sY = guiGetScreenSize(   ); 
local colors = { 
   [ "Rectangle" ] = { 255, 255, 255, 255 } 
   [ "Rectangle2" ] = { 255, 255, 255, 255 } 
}    
  
addEventHandler ( "onClientRender", root, function(    ) 
  dxDrawRectangle( 709, 244, 79, 24, tocolor(colors[ "Rectangle" ][1],colors[ "Rectangle" ][2],colors[ "Rectangle" ][3],colors[ "Rectangle" ][4]),true ) 
   if ( isCursorShowing(   ) == true ) then   
       local cx, cy = getCursorPosition(      ) 
       if ( cx*sX >= 709 and cx*sX <= 709+79 and cy*sY >= 244 and cy*sY <= 244+24 ) then 
            colors[ "Rectangle" ][1] = 255 
            colors[ "Rectangle" ][2] = 0 
            colors[ "Rectangle" ][3] = 100 
            colors[ "Rectangle" ][4] = 255 
        else 
            colors[ "Rectangle" ][1] = 255 
            colors[ "Rectangle" ][2] = 255 
            colors[ "Rectangle" ][3] = 255 
            colors[ "Rectangle" ][4] = 255   
         end 
     end 
end ) 

ناقص عندك الفواصل ف الجدول .

Link to comment
ما يحتاج تستخدمون لبل مخفي ومدري وش

بالنسبة للزرين .. سوي زي بالجدول وسوي زي الطريقة ذذ ومسوي لك ريتنكقل ثاني ويمديكـ تضيف

local sX, sY = guiGetScreenSize(   ); 
local colors = { 
   [ "Rectangle" ] = { 255, 255, 255, 255 } 
   [ "Rectangle2" ] = { 255, 255, 255, 255 } 
}    
  
addEventHandler ( "onClientRender", root, function(    ) 
  dxDrawRectangle( 709, 244, 79, 24, tocolor(colors[ "Rectangle" ][1],colors[ "Rectangle" ][2],colors[ "Rectangle" ][3],colors[ "Rectangle" ][4]),true ) 
   if ( isCursorShowing(   ) == true ) then   
       local cx, cy = getCursorPosition(      ) 
       if ( cx*sX >= 709 and cx*sX <= 709+79 and cy*sY >= 244 and cy*sY <= 244+24 ) then 
            colors[ "Rectangle" ][1] = 255 
            colors[ "Rectangle" ][2] = 0 
            colors[ "Rectangle" ][3] = 100 
            colors[ "Rectangle" ][4] = 255 
        else 
            colors[ "Rectangle" ][1] = 255 
            colors[ "Rectangle" ][2] = 255 
            colors[ "Rectangle" ][3] = 255 
            colors[ "Rectangle" ][4] = 255   
         end 
     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...