Jump to content

* [ شرح ] محترفين الوظائف المفيدة / ادخل وفيدني


Recommended Posts

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

ابي اعرف بعد الاشياء عن الاكواد المفيدة
useful function

فيه امثلة كثيرة في الويكي وحاولت اجرب اكثر من مثال لكن ما يشتغل معي اي مثال

ابي اعرف وش المشكلة .. وابي اعرف كيف استعمل الاكواد المفيدة

وشكراً مقدماً

Link to comment
function dxDrawCircle( posX, posY, radius, width, angleAmount, startAngle, stopAngle, color, postGUI )
	if ( type( posX ) ~= "number" ) or ( type( posY ) ~= "number" ) then
		return false
	end
	
	local function clamp( val, lower, upper )
		if ( lower > upper ) then lower, upper = upper, lower end
		return math.max( lower, math.min( upper, val ) )
	end
	
	radius = type( radius ) == "number" and radius or 50
	width = type( width ) == "number" and width or 5
	angleAmount = type( angleAmount ) == "number" and angleAmount or 1
	startAngle = clamp( type( startAngle ) == "number" and startAngle or 0, 0, 360 )
	stopAngle = clamp( type( stopAngle ) == "number" and stopAngle or 360, 0, 360 )
	color = color or tocolor( 255, 255, 255, 200 )
	postGUI = type( postGUI ) == "boolean" and postGUI or false
	
	if ( stopAngle < startAngle ) then
		local tempAngle = stopAngle
		stopAngle = startAngle
		startAngle = tempAngle
	end
	
	for i = startAngle, stopAngle, angleAmount do
		local startX = math.cos( math.rad( i ) ) * ( radius - width )
		local startY = math.sin( math.rad( i ) ) * ( radius - width )
		local endX = math.cos( math.rad( i ) ) * ( radius + width )
		local endY = math.sin( math.rad( i ) ) * ( radius + width )
	
		dxDrawLine( startX + posX, startY + posY, endX + posX, endY + posY, color, width, postGUI )
	end
	
	return true
end

local screenWidth, screenHeight = guiGetScreenSize( )
local stopAngle = 0

addEventHandler( "onClientRender", root,
	function( )
		if ( stopAngle < 360 ) then
			stopAngle = stopAngle + 5
		else
			stopAngle = 0
		end
		
		dxDrawCircle( screenWidth / 2, screenHeight / 2, nil, nil, nil, nil, stopAngle )
	end
)

 

  • Like 1
Link to comment
Just now, #_iMr.[E]coo said:

function dxDrawCircle( posX, posY, radius, width, angleAmount, startAngle, stopAngle, color, postGUI )
	if ( type( posX ) ~= "number" ) or ( type( posY ) ~= "number" ) then
		return false
	end
	
	local function clamp( val, lower, upper )
		if ( lower > upper ) then lower, upper = upper, lower end
		return math.max( lower, math.min( upper, val ) )
	end
	
	radius = type( radius ) == "number" and radius or 50
	width = type( width ) == "number" and width or 5
	angleAmount = type( angleAmount ) == "number" and angleAmount or 1
	startAngle = clamp( type( startAngle ) == "number" and startAngle or 0, 0, 360 )
	stopAngle = clamp( type( stopAngle ) == "number" and stopAngle or 360, 0, 360 )
	color = color or tocolor( 255, 255, 255, 200 )
	postGUI = type( postGUI ) == "boolean" and postGUI or false
	
	if ( stopAngle < startAngle ) then
		local tempAngle = stopAngle
		stopAngle = startAngle
		startAngle = tempAngle
	end
	
	for i = startAngle, stopAngle, angleAmount do
		local startX = math.cos( math.rad( i ) ) * ( radius - width )
		local startY = math.sin( math.rad( i ) ) * ( radius - width )
		local endX = math.cos( math.rad( i ) ) * ( radius + width )
		local endY = math.sin( math.rad( i ) ) * ( radius + width )
	
		dxDrawLine( startX + posX, startY + posY, endX + posX, endY + posY, color, width, postGUI )
	end
	
	return true
end

local screenWidth, screenHeight = guiGetScreenSize( )
local stopAngle = 0

addEventHandler( "onClientRender", root,
	function( )
		if ( stopAngle < 360 ) then
			stopAngle = stopAngle + 5
		else
			stopAngle = 0
		end
		
		dxDrawCircle( screenWidth / 2, screenHeight / 2, nil, nil, nil, nil, stopAngle )
	end
)

 


الحين فهمتها شكراً لك ايكو

Just now, iMr.WiFi..! said:

شوف انت لما تدخل على أي وظيفة مفيدة , بيكون لها سورس كود

انت حط السورس كود فوق وكمل الباقي 


شكراً لك :D

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