Jump to content

x[ مساعدة]x مساعدة المرجو الدخول من المحترفين ^^"


Recommended Posts

سلام عليكم , هلا والله شباب

امس كنت احاول اسوي مكتبة دي إكس حقتي ، ( ليش أستعمل حقت الناس وأنا اظن اقدر اسوي حقتي ، عندهم عقل وانا ولا ؟ هههه ) .المهم 

وش الخطأ هنا بالله



function coNdxLibCreateButton(PosX,PosY,SizeX,SizeY,ButtonText,ButtonTextColor,ButtonColor,postGUI)
local PosX,PosY,SizeX,SizeY = tonumber(PosX),tonumber(PosY),tonumber(SizeX),tonumber(SizeY)
	if PosX and PosY and SizeX and SizeY then
	local dxLibButtonElement = createElement("dxLibButton")
		if dxLibButtonElement then
			local dxButtonData = {}
			dxButtonData.PosX = PosX
			dxButtonData.PosY = PosY
			dxButtonData.SizeX = SizeX
			dxButtonData.SizeY = SizeY
			dxButtonData.ButtonText = ButtonText or "dxLibButton"
			dxButtonData.ButtonTextColor = ButtonTextColor or tocolor(255,255,255,240)
			dxButtonData.ButtonColor = ButtonColor or tocolor(220,220,220,250)
			dxButtonData.postGUI = postGUI or false
			else
		outputDebugString( "dxLibElements , Can't Create An Element (coNdxLibCreateButton) ", 3 , 255, 150, 0 )
		setElementData(dxLibButtonElement,"dxLibData",dxButtonData, false)

		end
			outputDebugString( "dxLibElements , coNdxLibCreateButton Created Successfully ", 3 , 255, 150, 0 )
	else 
	outputDebugString("Error At Creating The Button ( coNdxLibCreateButton ), Missing Arguments ! ", 3 , 255, 255, 255 )
	end
	
end

function coNdxLibDrawButton(dxLibButtonElement)
	if dxLibButtonElement then
	local drawData = getElementData(dxLibButtonElement,"dxLibData")
		if drawData and type(drawData) == "table" then
		drawData.PosX = PosX or drawData.PosX
		drawData.PosY = PosY or drawData.PosY
		drawData.SizeX = SizeX or drawData.SizeX
		drawData.ButtonText = ButtonText or drawData.ButtonText
		drawData.ButtonTextColor = ButtonTextColor or drawData.ButtonTextColor
		drawData.ButtonColor = ButtonColor or drawData.ButtonColor
		drawData.postGUI = postGUI or drawData.postGUI
		
		
		local PosX = drawData.PosX
		local PosY = drawData.PosY
		local SizeX = drawData.SizeX
		local SizeY = drawData.SizeY
		
		dxDrawRectangle(PosX,PosY,SizeX,SizeY,ButtonColor,postGUI)
		dxDrawText(ButtonText,PosX+(SizeX/2), PosY + (SizeY/2), SizeX, SizeY, ButtonTextColor, 1.2, "default", "center", "center", true,false,postGUI,true)
		
		
		setElementData(dxLibButtonElement,"dxLibData",drawData,true)

		end
	end
end

 

Link to comment
5 hours ago, coNolel said:

سلام عليكم , هلا والله شباب

امس كنت احاول اسوي مكتبة دي إكس حقتي ، ( ليش أستعمل حقت الناس وأنا اظن اقدر اسوي حقتي ، عندهم عقل وانا ولا ؟ هههه ) .المهم 

وش الخطأ هنا بالله



function coNdxLibCreateButton(PosX,PosY,SizeX,SizeY,ButtonText,ButtonTextColor,ButtonColor,postGUI)
local PosX,PosY,SizeX,SizeY = tonumber(PosX),tonumber(PosY),tonumber(SizeX),tonumber(SizeY)
	if PosX and PosY and SizeX and SizeY then
	local dxLibButtonElement = createElement("dxLibButton")
		if dxLibButtonElement then
			local dxButtonData = {}
			dxButtonData.PosX = PosX
			dxButtonData.PosY = PosY
			dxButtonData.SizeX = SizeX
			dxButtonData.SizeY = SizeY
			dxButtonData.ButtonText = ButtonText or "dxLibButton"
			dxButtonData.ButtonTextColor = ButtonTextColor or tocolor(255,255,255,240)
			dxButtonData.ButtonColor = ButtonColor or tocolor(220,220,220,250)
			dxButtonData.postGUI = postGUI or false
			else
		outputDebugString( "dxLibElements , Can't Create An Element (coNdxLibCreateButton) ", 3 , 255, 150, 0 )
		setElementData(dxLibButtonElement,"dxLibData",dxButtonData, false)

		end
			outputDebugString( "dxLibElements , coNdxLibCreateButton Created Successfully ", 3 , 255, 150, 0 )
	else 
	outputDebugString("Error At Creating The Button ( coNdxLibCreateButton ), Missing Arguments ! ", 3 , 255, 255, 255 )
	end
	
end

function coNdxLibDrawButton(dxLibButtonElement)
	if dxLibButtonElement then
	local drawData = getElementData(dxLibButtonElement,"dxLibData")
		if drawData and type(drawData) == "table" then
		drawData.PosX = PosX or drawData.PosX
		drawData.PosY = PosY or drawData.PosY
		drawData.SizeX = SizeX or drawData.SizeX
		drawData.ButtonText = ButtonText or drawData.ButtonText
		drawData.ButtonTextColor = ButtonTextColor or drawData.ButtonTextColor
		drawData.ButtonColor = ButtonColor or drawData.ButtonColor
		drawData.postGUI = postGUI or drawData.postGUI
		
		
		local PosX = drawData.PosX
		local PosY = drawData.PosY
		local SizeX = drawData.SizeX
		local SizeY = drawData.SizeY
		
		dxDrawRectangle(PosX,PosY,SizeX,SizeY,ButtonColor,postGUI)
		dxDrawText(ButtonText,PosX+(SizeX/2), PosY + (SizeY/2), SizeX, SizeY, ButtonTextColor, 1.2, "default", "center", "center", true,false,postGUI,true)
		
		
		setElementData(dxLibButtonElement,"dxLibData",drawData,true)

		end
	end
end

addEventHandler ( "onClientRender"

! ^

Link to comment
14 hours ago, #Soking said:

 أصلن وين الجدأول حقت

drawData

dxButtonData

و وين الدي بق

 

  1. setElementData(dxLibButtonElement,"dxLibData",dxButtonData, false)
  2. حاط الداتا ف جدول
13 hours ago, #BrosS said:

تاركين الاحتراف لك

كيف تقول اقدر اسوي مكتبة وهينك جيت بمشكل 

شوف الدي بق شيقول 

._.

لو تقرا زين ـ تفهم وش قلت

الديبوق ما يقول شي هذا اللي مخليني اجي هنا

Link to comment
function coNdxLibCreateButton(PosX,PosY,SizeX,SizeY,ButtonText,ButtonTextColor,ButtonColor,postGUI)
local PosX,PosY,SizeX,SizeY = tonumber(PosX),tonumber(PosY),tonumber(SizeX),tonumber(SizeY)
	if PosX and PosY and SizeX and SizeY then
	local dxLibButtonElement = createElement("dxLibButton")
		if dxLibButtonElement then
			local dxButtonData = {}
			dxButtonData.PosX = PosX
			dxButtonData.PosY = PosY
			dxButtonData.SizeX = SizeX
			dxButtonData.SizeY = SizeY
			dxButtonData.ButtonText = ButtonText or "dxLibButton"
			dxButtonData.ButtonTextColor = ButtonTextColor or tocolor(255,255,255,240)
			dxButtonData.ButtonColor = ButtonColor or tocolor(220,220,220,250)
			dxButtonData.postGUI = postGUI or false
		outputDebugString( "dxLibElements , coNdxLibCreateButton Created Successfully ", 3 , 255, 150, 0 )
		setElementData(dxLibButtonElement,"dxLibData",dxButtonData, false)
		return dxLibButtonElement
		end
	end				
end

function coNdxLibDrawButton(dxLibButtonElement)
	if dxLibButtonElement then
	local drawData = getElementData(dxLibButtonElement,"dxLibData")
		if drawData and type(drawData) == "table" then
		PosX = drawData.PosX
		PosY = drawData.PosY
		SizeX = drawData.SizeX
		SizeY = drawData.SizeY
		ButtonText = drawData.ButtonText
		ButtonTextColor = drawData.ButtonTextColor
		ButtonColor = drawData.ButtonColor
		postGUI = drawData.postGUI
		dxDrawRectangle(PosX,PosY,SizeX,SizeY,ButtonColor,postGUI)
		dxDrawText(ButtonText,PosX+(SizeX/2), PosY + (SizeY/2), SizeX, SizeY, ButtonTextColor, 1.2, "default", "center", "center", true,false,postGUI,true)
		setElementData(dxLibButtonElement,"dxLibData",drawData,true)

		end
	end
end

 

  • Like 1
Link to comment
12 minutes ago, Abdul KariM said:

function coNdxLibCreateButton(PosX,PosY,SizeX,SizeY,ButtonText,ButtonTextColor,ButtonColor,postGUI)
local PosX,PosY,SizeX,SizeY = tonumber(PosX),tonumber(PosY),tonumber(SizeX),tonumber(SizeY)
	if PosX and PosY and SizeX and SizeY then
	local dxLibButtonElement = createElement("dxLibButton")
		if dxLibButtonElement then
			local dxButtonData = {}
			dxButtonData.PosX = PosX
			dxButtonData.PosY = PosY
			dxButtonData.SizeX = SizeX
			dxButtonData.SizeY = SizeY
			dxButtonData.ButtonText = ButtonText or "dxLibButton"
			dxButtonData.ButtonTextColor = ButtonTextColor or tocolor(255,255,255,240)
			dxButtonData.ButtonColor = ButtonColor or tocolor(220,220,220,250)
			dxButtonData.postGUI = postGUI or false
		outputDebugString( "dxLibElements , coNdxLibCreateButton Created Successfully ", 3 , 255, 150, 0 )
		setElementData(dxLibButtonElement,"dxLibData",dxButtonData, false)
		return dxLibButtonElement
		end
	end				
end

function coNdxLibDrawButton(dxLibButtonElement)
	if dxLibButtonElement then
	local drawData = getElementData(dxLibButtonElement,"dxLibData")
		if drawData and type(drawData) == "table" then
		PosX = drawData.PosX
		PosY = drawData.PosY
		SizeX = drawData.SizeX
		SizeY = drawData.SizeY
		ButtonText = drawData.ButtonText
		ButtonTextColor = drawData.ButtonTextColor
		ButtonColor = drawData.ButtonColor
		postGUI = drawData.postGUI
		dxDrawRectangle(PosX,PosY,SizeX,SizeY,ButtonColor,postGUI)
		dxDrawText(ButtonText,PosX+(SizeX/2), PosY + (SizeY/2), SizeX, SizeY, ButtonTextColor, 1.2, "default", "center", "center", true,false,postGUI,true)
		setElementData(dxLibButtonElement,"dxLibData",drawData,true)

		end
	end
end

 

م أشتغل ، ما يجي شي بالرندر

Link to comment
12 minutes ago, Abdul KariM said:

جرب المثال


local screenW, screenH = guiGetScreenSize()

t = coNdxLibCreateButton ( screenW * 0.2950, screenH * 0.5200, screenW * 0.3950, screenH * 0.0433 )


addEventHandler ( "onClientRender" , root , 

	function (	)

	coNdxLibDrawButton ( t )

	end
 )

 

تسلم ، والله مافادني احد غيرك ، كلهم كلام ف كلام ، 

 

ممكن تقولي وش سويت عشان استفيد من الخطأ ؟ ض

Link to comment

الله يسلمك

بعد ماتحط داتا على البيانات تسوي ريتورن بالالمنت الي سويته coNdxLibCreateButton المفروض في الفنكشن

عشان تقدر تجيب الداتا الي عليه

اما كودك قبل ماكنت راجع بألمنت

والباقي واضح

  • Like 1
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...