nxFairlywell Posted January 9, 2019 Share Posted January 9, 2019 (edited) السلام عليكم , كنت فاضي وقعدت ادور على دالة تساعدني اني احدد هل الالمنت على الأرض أو في السماء حصلت دالة للوحش ولكن ما تنفع الا لملف الكلينت سويت دالة بنفس الوظيفة للسيرفر والكلينت راح تساعد المبتدئين والمتوسطين " الوظيفة تساعدك على تحديد هل الالمنت على الأرض أو فوق سطح الأرض " ( isElementOnGround ) arguments : 1- element -- الالمنت المطلوب مصدر الدالة : function isElementOnGround( element ) if element then if isElement(element) and type(element) ~= 'string' and type(element) ~= 'number' then local x, y, z = getElementPosition(element); if x and y and z then local ped = createPed ( 0, x, y, z ); if ped then local set_alpha = setElementAlpha ( ped, 0 ); local attach = attachElements( element, ped ); if attach and set_alpha then if isPedOnGround( ped ) then outputDebugString ( "@THIS ELEMENT ON GROUND", 0, 0, 255, 0 ) return true, destroyElement(ped) end if not isPedOnGround( ped ) then outputDebugString ( "@THIS ELEMENT ISN'T ON GROUND", 0, 255, 0, 0 ) return false, destroyElement(ped) end else return nil end else outputDebugString ( "@WRONG BY 'isElementOnGround' FUNCTION, PLEASE CHECK IT", 0, 255, 0, 0 ) return nil end else return nil end else outputDebugString ( "element in argument 1 isn't an element", 0, 255, 255, 0 ) return nil end else outputDebugString ( 'element in argument 1 got nil', 0, 255, 255, 0 ) return nil end end Edited January 9, 2019 by NX_CI Link to comment
^iiEcoo'x_) Posted January 10, 2019 Share Posted January 10, 2019 function isElementOnGround ( Element ) assert ( Element , 'Bad Argument #1 , nil value' ) assert ( isElement ( Element ) , 'Bg Argument #1 , not element' ) local Ped = createPed ( 0 , 0 , 0 , 0 ) setElementAlpha ( Ped , 0 ) attachElements ( Element , Ped ) return isPedOnGround ( Ped ) , destroyElement ( Ped ) end -- Ex. addCommandHandler ( 'OnGround' , function ( Player ) local OnGround , Value = isElementOnGround ( Player ) -- Value always return true if ( OnGround == true ) and ( Value == true ) outputChatBox ( 'You On Ground' , Player ) end end ) 1 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now