*[MSN]MHMD Posted April 29, 2015 Posted April 29, 2015 حبيب قلبي انت شوف انا م كنت اعرف انه عناد مسوي واحد نفس فايدته من قبلي واقول الشرح انقليزي لاني كنت مجهزه عشان اطرحه بالوظائف المفيدة بالويكي Useful Functions = وظائف مفيدة مو وظائف سهلة + اذا مو عجبك لا تعلق,, لاني م طلبت رأي حد +
*[MSN]MHMD Posted April 30, 2015 Posted April 30, 2015 # تبي تطرحة وموجود نفسة @ انا م كنت اعرف انه عناد مسوي واحد نفس فايدته من قبلي
ALw7sH Posted May 1, 2015 Posted May 1, 2015 formatDecimal فائدة الوظيفة: تقدر تختصر الارقام العشريه تاخذ منها مثلاً اول اثنين او ثلاثه او الي تبي Syntax: number formatDecimal( float number, float decimal ) Required Arguments: Number: الرقم الي تبي تحذف منه ارقام عشرية Decimal: كم رقم عشري تبي Function: function formatDecimal(number, decimal) if (number and type(number) == "number") then if (decimal and type(decimal) == "number") then if tostring(number):find(".") then local num = split(tostring(number),".") return tonumber(tostring(num[1]).."."..tostring(num[2]):sub(1,decimal)) else outputDebugString("Bad argument @ 'decimal' [Expected decimal number at argument 1]",2) end else outputDebugString("Bad argument @ 'decimal' [Expected number at argument 2, got "..type(decimal).."]",2) end else outputDebugString("Bad argument @ 'decimal' [Expected number at argument 1, got "..type(number).."]",2) end end Example: print(formatDecimal(1.35431,2)) -- 1.35 print(formatDecimal(1.2456784524,5)) -- 1.24567
The Killer Posted June 8, 2015 Posted June 8, 2015 formatDecimal فائدة الوظيفة: تقدر تختصر الارقام العشريه تاخذ منها مثلاً اول اثنين او ثلاثه او الي تبي وظيفه حلوه .. لاكن تقدر تستخدم string.format اسهل ..
</Mr.Tn6eL> Posted June 8, 2015 Posted June 8, 2015 formatDecimal فائدة الوظيفة: تقدر تختصر الارقام العشريه تاخذ منها مثلاً اول اثنين او ثلاثه او الي تبي وظيفه حلوه .. لاكن تقدر تستخدم string.format اسهل .. اصلا موجودة من اول https://wiki.multitheftauto.com/wiki/Math.round
ALw7sH Posted June 9, 2015 Posted June 9, 2015 formatDecimal فائدة الوظيفة: تقدر تختصر الارقام العشريه تاخذ منها مثلاً اول اثنين او ثلاثه او الي تبي وظيفه حلوه .. لاكن تقدر تستخدم string.format اسهل .. صح كلامك بس فيه ناس ماتعرف تستخدم string.format وبالنهايه كل واحد يستخدم الي يريحه اصلا موجودة من اولhttps://wiki.multitheftauto.com/wiki/Math.round فيه فرق بين وظيفتي والوظيفه الي انت حطيتها ماث راوند للتقريب وظيفتني ماراح تقرب
#Plair07 Posted June 16, 2015 Posted June 16, 2015 dxDrawTriangle وظيفة صنع مثلث function dxDrawTriangle(x, y, color, postGUI) for k=1,360 do local tx = 100 * math.sin(math.deg(k * math.pi / 90)) local ty = 100 * math.sin(math.atan(k * 3)) dxDrawLine(x, y, x + tx, y + ty, color, 1, postGUI) end end Example addEventHandler("onClientRender", root, function( ) dxDrawTriangle(400, 200, tocolor(255, 255, 255), false) end) جلست على الوظيفة 4 ساعات هههه الين ماضبط وظيفه حلوه وشاطحه , مبين عليك طموح
</Mr.Tn6eL> Posted June 16, 2015 Posted June 16, 2015 ALw7sH تقرب اذ حطيت الارقمنت الثالث وتحذف الارقام العشرية اذ ماحطيت الارقمنت الثالث لو تلاحظ الكود function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end #Plair07 شكرا
Jupi Posted June 21, 2015 Posted June 21, 2015 (edited) وظيفة toboolean تحول لك ال boolean ل string function tobool(string) if type ( string ) == 'string' then if string == 'true' then return true elseif string == 'True' then return true elseif string == 'false' then return false elseif string == 'False' then return false else return nil end end end مثال function HideChat() button = guiCreateButton(50, 50, 30, 100, "false", false)--عمل زر local mytext = guiGetText(button) -- احضار النصص المكتوب علي الزر اللي هو فالس showChat(tobool(mytext)) -- وضع الشات علي حسب الحالة المكتوبة علي الزر اللي فالس يعني يخفيه end Edited June 21, 2015 by Guest
TAPL Posted June 21, 2015 Posted June 21, 2015 وظيفة tobooleanتحول لك ال boolean ل string function tobool(string) if type ( string ) == 'string' then if string == 'true' then return true elseif string == 'True' then return true elseif string == 'false' then return false elseif string == 'False' then return false else return nil end end end مثال function HideChat() button = guiCreateButton(50, 50, 30, 100, "false", false)--عمل زر local mytext = guiGetText(button) -- احضار النصص المكتوب علي الزر اللي هو فالس showChat(toboolean(mytext)) -- وضع الشات علي حسب الحالة المكتوبة علي الزر اللي فالس يعني يخفيه end اسم الفنكشن بالمثال مختلف + راجع صفحة 10 بالموضوع ذا، الفنكشن انطرح من قبل
Jupi Posted June 21, 2015 Posted June 21, 2015 وظيفة tobooleanتحول لك ال boolean ل string function tobool(string) if type ( string ) == 'string' then if string == 'true' then return true elseif string == 'True' then return true elseif string == 'false' then return false elseif string == 'False' then return false else return nil end end end مثال function HideChat() button = guiCreateButton(50, 50, 30, 100, "false", false)--عمل زر local mytext = guiGetText(button) -- احضار النصص المكتوب علي الزر اللي هو فالس showChat(toboolean(mytext)) -- وضع الشات علي حسب الحالة المكتوبة علي الزر اللي فالس يعني يخفيه end اسم الفنكشن بالمثال مختلف + راجع صفحة 10 بالموضوع ذا، الفنكشن انطرح من قبل اسف ما كنت اعرف انه مطروح انا لقيت الموضوع حطيته و خلاص
MoDeR2014 Posted July 6, 2015 Posted July 6, 2015 السلام عليكم ورحمه الله وبركاته guiGridListCopySelectedItemText الفنكشن ينسخ لك الكتابه الي بالرو والكلومن المحدد Author : ProGamer Edited By : MoDeR2014 تم اخذ اذن من بروقيمر للنشر قبل التعديل function guiGridListSetClipboardText ( gridName , row , col ) if ( gridName and row and col ) then if ( guiGridListGetSelectedItem (gridName) ) then local text = guiGridListGetItemText(gridName,row,col) setClipboard(tostring(text)) end end end بعد التعديل function guiGridListCopySelectedItemText ( gridName , row , col ) if ( gridName and row and col ) then if ( guiGridListGetSelectedItem (gridName) ) then if ( guiGridListGetSelectedItem(gridName) ~= -1 ) then local text = guiGridListGetItemText(gridName,row,col) setClipboard(tostring(text)) end end end end اتمنى يكون عجبكم والسلام عليكم
Mr.R Posted July 8, 2015 Posted July 8, 2015 (edited) اتوقع انه يصير كذا ياخوان guiGridListCopySelectedItemText = function ( gridName , row , col ) if ( gridName and row and col ) then if ( guiGridListGetSelectedItem ( gridName ) ~= -1 ) then local text = guiGridListGetItemText ( gridName, row, col ) setClipboard ( text ) end end end عشان يقدرون يستخدمون الفنكشن كذا guiGridListCopySelectedItemText ( الكولمن ,الرو ,القريد ليست ) وطريقتكم صحيحه بعد والطريقتين شغاله تمام , بس فيه غلط حاطين تحقق انه اختار شيء من اللسته مرتين Edited July 8, 2015 by Guest
</Mr.Tn6eL> Posted July 8, 2015 Posted July 8, 2015 اتوقع انه يصير كذا ياخوان guiGridListCopySelectedItemText = function ( gridName , row , col ) if ( gridName and row and col ) then if ( guiGridListGetSelectedItem ( gridName ) ~= -1 ) then local text = guiGridListGetItemText ( gridName, row, col ) setClipboard ( tostring ( text ) ) end end end عشان يقدرون يستخدمون الفنكشن كذا guiGridListCopySelectedItemText ( الكولمن ,الرو ,القريد ليست ) وطريقتكم صحيحه بعد والطريقتين شغاله تمام , بس فيه غلط حاطين تحقق انه اختار شيء من اللسته مرتين ليش تحوله الى سلسلة نصية وهو اصلا سلسة نصية سطر 5 اصلا مايضر لكن تعب
Without-101 Posted July 10, 2015 Posted July 10, 2015 isPlayerInThisGroup فائدة هذا الفنشكن يقوم بتأكيد اذا اللاعب بالقروبات المحددة أم لا هذا هو الفانشكن جوجل مترجم function isPlayerInThisGroups ( player , groups ) -- بداية الفانشكن for i , group in ipairs ( groups ) then -- استخراج القاعدة account_name = getAccountName(getPlayerAccount ( player )) -- استخراج اسم حساب اللاعب isObjectInACLGroup ( "user." ..account_name, aclGetGroup ( group ) ) -- يقوم بفحص الحساب اذا هو بقروب الأي سي ال ام لا return true -- يرجع قيمة 'true' else -- اذا لم يكن بقروب الاي سي ال return false -- يرجع قيمة 'false' end -- النهاية ل فحص قروب اللاعب end -- نهاية استخراج القاعدة end -- نهاية الفانشكن الآن حان وقت التجربة addCommandHandler("Im Admin ?",function( p ) -- إضافة أمر if ( isPlayerInThisGroups ( p , { {"Admin"},{"Supermoderator"},{"Moderator"} } ) ) -- يقوم بفحص اللاعب اذا هو بهذه القروبات outputChatBox("Yes!",p,255,255,0) -- تنبيه اللاعب بإنه بقروب الاسل else -- اذا ماكان ادمن outputChatBox("No \"{SMILIES_PATH}/icon_sad.gif\" alt=\"\" title=\"Sad\" />",p,255,0,0)-- تنبيه اللاعب بإنه ليس بـ قروب الاسل end -- النهاية للفحص end ) -- النهاية لاضافة الأمر أتمنى ان الكود عجبكم مع السلامة
TAPL Posted July 10, 2015 Posted July 10, 2015 الموضوع للفنكشات المفيدة يعني قبل ما تفكر تطرح فنكشن فكر جيداً في جدوى و فائدة الفنكشن و قبل كل ذا جرب الفنكشن مليون مرة قبل ما تطرحه
</Mr.Tn6eL> Posted July 11, 2015 Posted July 11, 2015 isPlayerInThisGroup الآن حان وقت التجربة addCommandHandler("Im Admin ?",function( p ) -- إضافة أمر if ( isPlayerInThisGroups ( p , { {"Admin"},{"Supermoderator"},{"Moderator"} } ) ) -- يقوم بفحص اللاعب اذا هو بهذه القروبات outputChatBox("Yes!",p,255,255,0) -- تنبيه اللاعب بإنه بقروب الاسل else -- اذا ماكان ادمن outputChatBox("No \"{SMILIES_PATH}/icon_sad.gif\" alt=\"\" title=\"Sad\" />",p,255,0,0)-- تنبيه اللاعب بإنه ليس بـ قروب الاسل end -- النهاية للفحص end ) -- النهاية لاضافة الأمر أتمنى ان الكود عجبكم مع السلامة انت مش لسه شارب حشيش ؟ ايه تخبيص دا
The Killer Posted July 12, 2015 Posted July 12, 2015 No ! صححته , لاكن فيه مشكله انه في الحالتين لما اكون ادمن او ما اكون ادمن يقول local GroupsTable = { { "Console" }, } function isPlayerInThisGroups ( player, groups ) for _,v in ipairs ( GroupsTable ) do local AccountName = getAccountName ( getPlayerAccount ( player ) ) if ( isObjectInACLGroup ( "user."..AccountName, aclGetGroup ( "v[1]" ) ) ) then return true else return false end end end addCommandHandler ( "IamAdmin", function ( player ) if ( isPlayerInThisGroups ( player, "v[1]" ) ) then outputChatBox ( "Yes !", player, 255, 255, 255, true ) else outputChatBox ( "No !", player, 255, 255, 255, true ) end end ) هذا لأنك حاط "v[1]" بين علامة تنصيص وفي السطر 17 ناقصك لوب وبعد حاط "v[1]" بين علامة تنصيص
iMr.Dawix~# Posted July 13, 2015 Posted July 13, 2015 isEventHandlerAdded function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end هذا الفنكشن لقيته يستخدمه كثير ناس لكن فيه عرب ما يدرون عنه وهو مهم جدا ومهو موجود في https://wiki.multitheftauto.com/wiki/Useful_Functions حطيته هنا بـ رد بس عشان اللي يبيه ياخذه
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