Booo Posted November 12, 2012 Share Posted November 12, 2012 (edited) بسم الله الرحمن الرحيم Useful Arab functions - وظآيف مفيده :: فكرة الموضوع :: الموضوع فكرته عن مشاركه وظايف مفيده مع المبرمجين العرب ، زي ماتعرف ام تي آي غير كاملة بكل الإكوآد ، الكمال لله سبحانه لذالك هناك قصور ببعض الوظايف ، الي تجبرك انك تروح تبرمج وظيفة جديده علشان تفيدك بالبرمجه ومن خلال هالموضوع نود انك تشآركنا بالوظيفه الي برمجتها ، علشان تفيد نفسك وتفيد غيرك بالاستفادة من الوظيفه :: طموحنا :: نطمح أن تكون هناك مكتبه عآمه مبرمجه باأيدي عربيه تجمع اكواد مبرمجه لاختصار الوقت وتقديم وظايف مفيده لـ استخدامك ولاستخدام آي مبرمج عربي :: شروط آضافتك للوظيفه :: مافيه شروط محدده لكن هو شرط واحد ان الوظيفه تكون من برمجتك يعني ماهو تروح تأخذ نسخ لـ اي كود وتقول انا مبرمجه ، هي فالاخير ذمه و آمانه :: طريقة أضافة الوظيفة :: تحط هنا اسم الوظيفة صيغة الوظيفه تكتب هنا صيغة الوظيفه كود الوظيفه تكتب هنا كود الوظيفه مثال الوظيفه تكتب هنا مثال للوظيفه * ولابد تضع كودك هنا بالرابط ، وتحط الرابط مع مشآركتك https://wiki.multitheftauto.com/wiki/Useful_Functions https://wiki.multitheftauto.com/wiki/Te ... _Functions * فـهـرس الوظـائف المفيدة * [ Useful Arab's Functions ] | فهرس الوظائف المفيدة Edited October 23, 2016 by NssoR إضافة الفهرس للموضوع * 3 Link to comment
Booo Posted November 12, 2012 Author Share Posted November 12, 2012 (edited) string.byteArabic الوظيفه تقوم بتحويل الحروف العربية الى آرقام بآيت صيغة الوظيفه string.byteArabic(رقم الحرف الي تبي تطلع البايت,السلسلة النصية) كود الوظيفه arabic = { } arabic[20] = "ا" arabic[21] = "ب" arabic[22] = "ت" arabic[23] = "ث" arabic[24] = "ج" arabic[25] = "ح" arabic[26] = "خ" arabic[27] = "د" arabic[28] = "ذ" arabic[29] = "ر" arabic[30] = "ز" arabic[31] = "س" arabic[32] = "ش" arabic[33] = "ص" arabic[34] = "ض" arabic[35] = "ط" arabic[36] = "ظ" arabic[37] = "ع" arabic[38] = "غ" arabic[39] = "ف" arabic[40] = "ق" arabic[41] = "ك" arabic[42] = "ل" arabic[43] = "م" arabic[44]= "ن" arabic[45]= "ه" arabic[46]= "و" arabic[47]= "ي" arabic[48]= "ى" arabic[49]= "ؤ" arabic[50]= "ء" arabic[51]= "ئ" arabic[52]= "ة" arabic[53]= "لا" arabic[54]= "لأ" arabic[55]= "أ" arabic[56]= "آ" arabic[57]= "لآ" function isHasArabic(txt) local byte = string.byte(txt) if ((byte == 216) or (byte == 217)) then return true end return false end function string.byteArabic(str,num) if ((type(str) == "string") and (type(num) == "number")) then local Lstr = string.len(str) local numM = math.abs(math.ceil(num)) if Lstr >= numM then local S1 = string.sub(str,num,tonumber(num+1)) if isHasArabic(S1) then for k,v in pairs(arabic) do if (S1 == v) then return k end end end end end return 0 end مثال local str = "مرحبا" local booo = string.byteArabic(str,1) outputChatBox(booo) > 43 Edited April 2, 2014 by Guest Link to comment
Sora Posted November 13, 2012 Share Posted November 13, 2012 (edited) Comment removed. Edited May 12, 2013 by Guest Link to comment
Blaawee Posted November 13, 2012 Share Posted November 13, 2012 مفيده في توسيط النوآفذ function local sx, sy = guiGetScreenSize() function centerTheGUI( guiElement ) local width, height = guiGetSize( guiElement, false ) local x, y = sx / 2 - width / 2, sy / 2 - height / 2 guiSetPosition( guiElement, x, y, false ) end : مثال window = guiCreateWindow( 349, 205, 332, 209, "GUI Window", false ) centerTheGUI( window ) Link to comment
Booo Posted November 13, 2012 Author Share Posted November 13, 2012 (edited) وظيفة character codes للغه العربيه جآلس ثلاث ساعات شغآل عليها بس تستآهل .. وظيفه مهمه أتركم مع الكود arabic = { } arabic[20] = "ا" arabic[21] = "ب" arabic[22] = "ت" arabic[23] = "ث" arabic[24] = "ج" arabic[25] = "ح" arabic[26] = "خ" arabic[27] = "د" arabic[28] = "ذ" arabic[29] = "ر" arabic[30] = "ز" arabic[31] = "س" arabic[32] = "ش" arabic[33] = "ص" arabic[34] = "ض" arabic[35] = "ط" arabic[36] = "ظ" arabic[37] = "ع" arabic[38] = "غ" arabic[39] = "ف" arabic[40] = "ق" arabic[41] = "ك" arabic[42] = "ل" arabic[43] = "م" arabic[44]= "ن" arabic[45]= "ه" arabic[46]= "و" arabic[47]= "ي" arabic[48]= "ى" arabic[49]= "ؤ" arabic[50]= "ء" arabic[51]= "ئ" arabic[52]= "ة" arabic[53]= "لا" arabic[54]= "لأ" arabic[55]= "أ" arabic[56]= "آ" arabic[57]= "لآ" function isHasArabic(txt) local byte = string.byte(txt) if ((byte == 216) or (byte == 217)) then return true end return false end function string.byteArabic(str,num) if ((type(str) == "string") and (type(num) == "number")) then local Lstr = string.len(str) local numM = math.abs(math.ceil(num)) if Lstr >= numM then local S1 = string.sub(str,num,tonumber(num+1)) if isHasArabic(S1) then for k,v in pairs(arabic) do if (S1 == v) then return k end end end end end return 0 end Edited February 8, 2013 by Guest Link to comment
==>ҭᾄlᾄl Posted November 14, 2012 Share Posted November 14, 2012 وظيفة character codes للغه العربيه جآلس ثلاث ساعات شغآل عليها بس تستحق .. وظيفه مهمه أتركم مع الكود arabic = { ["20"] = "ا", ["21"] = "ب", ["22"] = "ت", ["23"] = "ث", ["24"] = "ج", ["25"] = "ح", ["26"] = "خ", ["27"] = "د", ["28"] = "ذ", ["29"] = "ر", ["30"] = "ز", ["31"] = "س", ["32"] = "ش", ["33"] = "ص", ["34"] = "ض", ["35"] = "ط", ["36"] = "ظ", ["37"] = "ع", ["38"] = "غ", ["39"] = "ف", ["40"] = "ق", ["41"] = "ك", ["42"] = "ل", ["43"] = "م", ["44"]= "ن", ["45"]= "ه", ["46"]= "و", ["47"]= "ي", ["48"]= "ى", ["49"]= "ؤ", ["50"]= "ء", ["51"]= "ئ", ["52"]= "ة", ["53"]= "لا", ["54"]= "لأ", ["55"]= "أ", ["56"]= "آ", ["57"]= "لآ" } function isHasArabic(txt) local byte = string.byte(txt) if ((byte == 216) or (byte == 217)) then return true end return false end function string.byteArabic(str,num) if ((type(str) == "string") and (type(num) == "number")) then local Lstr = string.len(str) local numM = math.abs(math.ceil(num)) if Lstr >= numM then local S1 = string.sub(str,num,tonumber(num+1)) if isHasArabic(S1) then for k,v in pairs(arabic) do if (S1 == v) then return k end end end end end return 0 end وش فائدة الوظيفه لو سمحت Link to comment
Booo Posted November 14, 2012 Author Share Posted November 14, 2012 وظيفة character codes للغه العربيه جآلس ثلاث ساعات شغآل عليها بس تستحق .. وظيفه مهمه أتركم مع الكود arabic = { ["20"] = "ا", ["21"] = "ب", ["22"] = "ت", ["23"] = "ث", ["24"] = "ج", ["25"] = "ح", ["26"] = "خ", ["27"] = "د", ["28"] = "ذ", ["29"] = "ر", ["30"] = "ز", ["31"] = "س", ["32"] = "ش", ["33"] = "ص", ["34"] = "ض", ["35"] = "ط", ["36"] = "ظ", ["37"] = "ع", ["38"] = "غ", ["39"] = "ف", ["40"] = "ق", ["41"] = "ك", ["42"] = "ل", ["43"] = "م", ["44"]= "ن", ["45"]= "ه", ["46"]= "و", ["47"]= "ي", ["48"]= "ى", ["49"]= "ؤ", ["50"]= "ء", ["51"]= "ئ", ["52"]= "ة", ["53"]= "لا", ["54"]= "لأ", ["55"]= "أ", ["56"]= "آ", ["57"]= "لآ" } function isHasArabic(txt) local byte = string.byte(txt) if ((byte == 216) or (byte == 217)) then return true end return false end function string.byteArabic(str,num) if ((type(str) == "string") and (type(num) == "number")) then local Lstr = string.len(str) local numM = math.abs(math.ceil(num)) if Lstr >= numM then local S1 = string.sub(str,num,tonumber(num+1)) if isHasArabic(S1) then for k,v in pairs(arabic) do if (S1 == v) then return k end end end end end return 0 end وش فائدة الوظيفه لو سمحت يحول لك الحروف ل خروزميه http://www.asciitable.com/ Link to comment
Booo Posted November 15, 2012 Author Share Posted November 15, 2012 إلحمدلله تم الانتهاء من وظيفة تحويل الشارتر الى حروف الوظيفه string.charArabic() مثآل local txt = string.charArabic(21,46,46) outputChatBox(txt) > بوو إتركم مع الكود arabic = { } arabic[20] = "ا" arabic[21] = "ب" arabic[22] = "ت" arabic[23] = "ث" arabic[24] = "ج" arabic[25] = "ح" arabic[26] = "خ" arabic[27] = "د" arabic[28] = "ذ" arabic[29] = "ر" arabic[30] = "ز" arabic[31] = "س" arabic[32] = "ش" arabic[33] = "ص" arabic[34] = "ض" arabic[35] = "ط" arabic[36] = "ظ" arabic[37] = "ع" arabic[38] = "غ" arabic[39] = "ف" arabic[40] = "ق" arabic[41] = "ك" arabic[42] = "ل" arabic[43] = "م" arabic[44]= "ن" arabic[45]= "ه" arabic[46]= "و" arabic[47]= "ي" arabic[48]= "ى" arabic[49]= "ؤ" arabic[50]= "ء" arabic[51]= "ئ" arabic[52]= "ة" arabic[53]= "لا" arabic[54]= "لأ" arabic[55]= "أ" arabic[56]= "آ" arabic[57]= "لآ" function string.charArabic(b1 ,b2 ,b3 ,b4 ,b5 ,b6 ,b7 ,b8 ,b9 ,b10 ,b11 ,b12 ,b13 ,b14 ,b15 ,b16 ,b17 ,b18 ,b19 ,b20 ,b21 ,b22 ,b23 ,b24 ,b25 ,b26 ,b27 ,b28 ,b29 ,b30 ,b31 ,b32 ,b33 ,b34 ,b35 ,b36 ,b37 ,b38 ,b39 ,b40 ,b41 ,b42 ,b43 ,b44 ,b45 ,b46 ,b47 ,b48 ,b49 ,b50 ,b51 ,b52 ,b53 ,b54 ,b55 ,b56 ,b57 ,b58 ,b59 ,b60 ,b61 ,b62 ,b63 ,b64 ,b65 ,b66 ,b67 ,b68 ,b69 ,b70 ,b71 ,b72 ,b73 ,b74 ,b75 ,b76 ,b77 ,b78 ,b79 ,b80 ,b81 ,b82 ,b83 ,b84 ,b85 ,b86 ,b87 ,b88 ,b89 ,b90 ,b91 ,b92 ,b93 ,b94 ,b95 ,b96 ,b97 ,b98 ,b99 ,b100 ,b101 ,b102 ,b103 ,b104 ,b105 ,b106 ,b107 ,b108 ,b109 ,b110 ,b111 ,b112 ,b113 ,b114 ,b115 ,b116 ,b117 ,b118 ,b119 ,b120 ,b121 ,b122 ,b123 ,b124 ,b125 ,b126 ,b127 ,b128 ,b129 ,b130 ,b131 ,b132 ,b133 ,b134 ,b135 ,b136 ,b137 ,b138 ,b139 ,b140 ,b141 ,b142 ,b143 ,b144 ,b145 ,b146 ,b147 ,b148 ,b149 ,b150 ,b151 ,b152 ,b153 ,b154 ,b155 ,b156 ,b157 ,b158) local boo = { } local boo2 = { } table.insert(boo,b1) table.insert(boo,b2) table.insert(boo,b3) table.insert(boo,b4) Link to comment
Booo Posted February 8, 2013 Author Share Posted February 8, 2013 (edited) كود لتأكد من قروب لاعب بالكلنت تم تعديل الكود كلنت function isPlayerGroupName(grp) triggerServerEvent ( "onServerIsRG", getLocalPlayer(),getLocalPlayer(), grp) if getElementData(getLocalPlayer(),"IsRG") == tostring(grp) then return true end return false end سيرفر function OSF (pla, grp ) if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( tostring(grp) ) ) then setElementData(pla,"IsRG",tostring(grp)) else setElementData(pla,"IsRG","noG") end end addEvent( "onServerIsRG", true ) addEventHandler( "onServerIsRG", getRootElement(), OSF ) مثآل GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(0,0,542,374," ",false) GUIEditor_TabPanel[3] = guiCreateTabPanel(9,24,524,341,false,GUIEditor_Window[1]) GUIEditor_Tab[3] = guiCreateTab(" ",GUIEditor_TabPanel[3]) GUIEditor_TabPanel[4] = guiCreateTabPanel(135,151,5,5,false,GUIEditor_Tab[3]) GUIEditor_Tab[5] = guiCreateTab(" ",GUIEditor_TabPanel[3]) closeButton = guiCreateButton(480,5,36,23,"~[x]~",false,GUIEditor_Tab[3]) guiSetVisible ( GUIEditor_Window[1], false ) bindKey( "F2", "down", function ( ) if isPlayerGroupName("POLICE") then guiSetVisible ( GUIEditor_Window[1],true) showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) guiSetInputEnabled( guiGetVisible ( GUIEditor_Window[1] ) ) else outputChatBox("no In Group") end end ) ------------------------------------- Edited June 7, 2013 by Guest Link to comment
hassan.k.s.a Posted February 8, 2013 Share Posted February 8, 2013 (edited) -- Edited April 30, 2014 by Guest Link to comment
3NAD Posted March 16, 2013 Share Posted March 16, 2013 وظيفة تغيير قيَم القريد لست إلى أسماء اللاعبين .. changeGridListItemToPlayersName = function ( GridList, Column ) if GridList and Column then -- Check Parematers if getElementType ( GridList ) == "gui-gridlist" then -- Check The Type of ' GridList ' if guiGridListClear ( GridList ) then -- Clear GridList for i, v in next, getElementsByType ( "player" ) do -- Get Everything by Type ' player ' local Row = guiGridListAddRow ( GridList ) -- Add Row guiGridListSetItemText ( GridList, Row, Column, getPlayerName ( v ), false, false ); -- Set New Values end; -- end of ' for ' end; -- end of ' clear gridlist ' end; -- end of ' check gridlist type ' end; -- end of ' check parematers end; -- end of ' function ' مثآل : wnd = guiCreateWindow ( 100, 100, 400, 400, "Test", false ); -- Create Window grid = guiCreateGridList ( 25, 30, 350, 350, false, wnd ); -- Create Gridlist col = guiGridListAddColumn ( grid, "Players", 0.9 ); -- Create Column changeGridListItemToPlayersName ( grid, col ); -- Set Gridlist Values Link to comment
PaiN^ Posted March 18, 2013 Share Posted March 18, 2013 بسمـ الله الرحمن الرحيمـ وظيفة guiGridListGetSelectedItemText الحصول على نص الغرض المختار من أي جريد لست string guiGridListGetSelectedItemText ( element gridList [, int column ] ) يعني نص وهو نص الغرض المختار في لوحة القريد لست المحددة string الوظيفة ترجع لك false أما إذا كان نص الغرض المحدد فاضي فترجعلك الكود function guiGridListGetSelectedItemText ( gridList, column ) local item = guiGridListGetSelectedItem ( gridList ) local text = guiGridListGetItemText ( gridList, item, column or 1 ) if ( text ~= '' ) then return text else return false end end column مثال بدون إستخدام الـ wnd = guiCreateWindow ( X, Y, Width, Height, 'Example', false, false ) -- لعمل نافذة gridList = guiCreateGridList ( X, Y, Width, Height, false, wnd ) -- لعمل قريد في النافذة guiGridListGetSelectedItemText ( GridList ) -- للحصول على نص الغرض المختار column مثال بإستخدام الـ wnd = guiCreateWindow ( X, Y, Width, Height, 'Example', false, false ) -- لعمل نافذة gridList = guiCreateGridList ( X, Y, Width, Height, false, wnd ) -- لعمل قريد في النافذة column = guiGridListAddColumn ( gridList, 'Example', 0.8 ) -- في القريد column لعمل guiGridListGetSelectedItemText ( gridList, column ) -- للحصول على نص الغرض المختار ** column = عمود Link to comment
3NAD Posted March 26, 2013 Share Posted March 26, 2013 وظيفة إخفاء وإظهار النافذة بـ سهولة .. Syntax: bool setBindKeyWindowShow ( element Window, string key ) Code: setBindKeyWindowShow = function ( guiWindow, key ) if guiWindow and key then if getElementType ( guiWindow ) == "gui-window" then guiSetVisible ( guiWindow, false ); local setBindKey_ = function ( key ) guiSetVisible ( guiWindow, not guiGetVisible ( guiWindow ) ); showCursor ( guiGetVisible ( guiWindow ) ); end return bindKey ( key, "down", setBindKey_ ); else return false; end else return false; end end Ex.: Window = guiCreateWindow ( 40, 40, 200, 200, "Test", false ) -- Create window. setBindKeyWindowShow ( Window, "f2" ) -- Enable function on it. https://wiki.multitheftauto.com/wiki/Se ... WindowShow Link to comment
Tete omar Posted April 14, 2013 Share Posted April 14, 2013 getPlayerFromSerial هذه الوظيفة تجيب لاعب من سيرياله. Syntax: player getPlayerFromSerial(serial) Required arguments: serial: السيريال الذي تريد ان تجيب اللاعب منه Returns: ترجع لاعب اذا كان السيريال صحيح واللاعب صاحب السيريال موجود بالسيرفر Code : function getPlayerFromSerial ( serial ) if serial and type(serial) == "string" then for i, v in ipairs(getElementsByType("player")) do if getPlayerSerial(v) == serial then return v end end end return false end Link to comment
Booo Posted April 14, 2013 Author Share Posted April 14, 2013 بسم الله الرحمن الرحيم تحويل الجدول الى سلسله نصيه convertTabToString(tab,key) Optional Arguments : key: أختياري ادخال مفتاح الجدول ملإحظة: الجدول لازم يكون بدون مفآتيح فقط قيم مثل tab = {"1","2","3"} او مثل الجدول هذآ tab = { ["test1"] = {"1","2","3"}, ["test2"] = {"1","2","3"}, } function convertTabToString(tab,key) if tab and type(tab) == "table" then TabToStr_BoOo = " " if key and type(key) == "string" then for k,v in pairs (tab) do if k == key then TabToStr_BoOo = " "..TabToStr_BoOo.." "..v.."," end end return TabToStr_BoOo else for kk,vv in ipairs (tab) do TabToStr_BoOo = " "..TabToStr_BoOo.." "..vv.."," end return TabToStr_BoOo end else return false end end Link to comment
PaiN^ Posted April 24, 2013 Share Posted April 24, 2013 (edited) isPlayerInACLGroup فنكشن للتحقق من إن لاعب محدد في قروب أسل معين Syntax : bool isPlayerInACLGroup ( element player, string group ) الكود سيرفر فقط | Server Side only function isPlayerInACLGroup ( player, group ) if player and group then if type( group ) ~= 'string' then return false end for _,aclG in next, aclGroupList ( ) do local name = aclGroupGetName ( aclG ); if name ~= group then return false end end if isElement ( player ) then local account = getPlayerAccount ( player ); if account == nil or isGuestAccount ( account ) then return false end local accountName = getAccountName ( account ); if isObjectInACLGroup ( 'user.'..accountName, aclGetGroup ( group ) ) then return true else return false end else return false end else return false end end Edit : ,, تم إضافة التحقق من القروب Edited April 25, 2013 by Guest Link to comment
3NAD Posted April 24, 2013 Share Posted April 24, 2013 وظيفة ممتازة .. لكن لو تضيف لها شرط .. تأكيد وجود القروب في الأسل Link to comment
iPrestege Posted April 25, 2013 Share Posted April 25, 2013 DoesPlayerHaveTeam Client | Server : Function السلام عليكم و رحمة الله وبركاتة .. آخبآركم آن شاء الله آلكل بـ صحة و سلآمةة .. اليوم حبيت اطرح وظيفة مفيدهـ و تسهل عليكـ بـ حيث يوم تسوي شيء تتحق انة الاعب بـ التيم هذآ آو لآ تآبع الامثلة و السآينتكس # [color=#008000]DoesPlayerHaveTeam[/color] Function Syntax : bool DoesPlayerHaveTeam ( player , string TeamName ) Source Function : function DoesPlayerHaveTeam( element,team ) if ( ( element ) and ( team ) ) then if ( isElement ( element ) ) then local type = getElementType(element) if type ~= "player" then outputDebugString ( "Bad argument @ DoesPlayerHaveTeam", 0, 112, 112, 112 ) return false end local GetTeam = getPlayerTeam( element ) if ( ( GetTeam ) and getTeamName( GetTeam ) == ( team ) ) then return true else return nil end end end end Exmples | أمثلة Client : addCommandHandler("Check", function ( ) if ( DoesPlayerHaveTeam ( localPlayer , "Police" ) ) then setPedHeadless ( localPlayer , false ) outputChatBox( "* You Are a Police Officer!",0,0,255 ) else setPedHeadless( localPlayer, true ) outputChatBox( "* You Are Not a Police Officer!",255,0,0 ) end end ) Server : addCommandHandler("Check", function ( element ) if ( DoesPlayerHaveTeam ( element , "Police" ) ) then setPedArmor ( element , 100 ) outputChatBox( "* You Are a Police Officer!",element,0,0,255 ) outputChatBox( "* You Get 100 % Armor !",element,0,255,0 ) else setPedArmor ( element, 50 ) outputChatBox( "* You Are Not a Police Officer!",element,255,0,0 ) outputChatBox( "* You Get 50 % Armor !",element,155,0,0 ) end end ) صفحة الوظيفة على الويكي : DoesPlayerHaveTeam و السلام عليكم و رحمة الله وبركآتة .. Link to comment
3NAD Posted April 25, 2013 Share Posted April 25, 2013 https://wiki.multitheftauto.com/wiki/IsPlayerInTeam Link to comment
MR.S3D Posted April 25, 2013 Share Posted April 25, 2013 https://wiki.multitheftauto.com/wiki/IsPlayerInTeam كود برستيج أفضل من اللي موجود في الموقع Link to comment
iPrestege Posted April 25, 2013 Share Posted April 25, 2013 https://wiki.multitheftauto.com/wiki/IsPlayerInTeam مآكنت عآرف عنهآ .. وكودي فية تحقق من آشيآء آكثر آفضل .. Link to comment
|Mr|-Talal07-| Posted April 25, 2013 Share Posted April 25, 2013 getLoginPlayers Server Side Syntax table getLoginPlayers() Return: جدول بكل الاعبين المسجلين Function Source function getLoginPlayers() local loginPlayers = {} for _,player in ipairs(getElementsByType("player")) do if not isGuestAccount(getPlayerAccount(player)) then table.insert(loginPlayers,player) end end return loginPlayers end Example addCommandHandler("loginplayers", function (player) outputChatBox("- Login Players:",player) for _,ply in ipairs(getLoginPlayers()) do outputChatBox("- " .. getPlayerName(ply),player) end end ) getLoginPlayers وشكـرآآ ... 1 Link to comment
iPrestege Posted April 25, 2013 Share Posted April 25, 2013 CreateTextItem Server : Function السلام عليكم و رحمة الله وبركاتة .. آخبآركم آن شاء الله آلكل بـ صحة و سلآمةة .. اليوم حبيت اطرح وظيفة مفيدهـ و تسهل عليكـ بـ حيث تقدر تسوي كلام بـكل سهولة وبسآطة تآبع الامثلة و السآينتكس # Function Syntax : [color=#FF8000]CreateTextItem[/color] bool CreateTextItem ( player playerToAdd , time, int red = 255, int green = 255, int blue = 255, float scale = 1, string text, [ float x, float y, string alignX = "left", string alignY = "top"] ) Required Arguments playerToAdd: The player that should observe the textdisplay. time: The number of times you want to the remove The textdisplay ,number of milliseconds (the minimum is 50)(1000 milliseconds = 1 second) red: A value between 0 and 255 indicating how red the text should be. green: A value between 0 and 255 indicating how green the text should be. blue: A value between 0 and 255 indicating how blue the text should be. scale: A floating point value indicating the scale of the text. The default is 1.0, which is around 12pt. text: A string of text you want to display Optional Arguments x: A floating point number between 0.0 and 1.0 indicating how far across the screen the text should be shown, as a percentage of the width, from the left hand side. y: A floating point number between 0.0 and 1.0 indicating how far down the screen the text should be shown, as a percentage of the height, from the top. scale: A floating point value indicating the scale of the text. The default is 1.0, which is around 12pt. alignX: A string representing the X-alignment of the text. ("left", "center", "right") alignY: A string representing the Y-alignment of the text. ("top", "center", "bottom") Source Function : function CreateTextItem ( player, time, r, g, b, scale, text, x, y, alignX, alignY) if not player or not time or not text then return end if not tonumber(r) and not tonumber(g) and not tonumber(b) then r, g, b = 255, 0, 0 end if not scale then scale = 1 end if ( isElement( player ) and type ( text ) == 'string' and tonumber( time) ) then local Display = textCreateDisplay () local newtextItem = textCreateTextItem ( text, x or 0.5, y or 0.5, 2, r, g, b, 255, scale, alignX or "center", alignY or "center" ) textDisplayAddText ( Display, newtextItem ) textDisplayAddObserver ( Display, player ) setTimer(textDestroyTextItem, time, 1, newtextItem) setTimer(textDestroyDisplay, time, 1, Display) end end Exmple | مثال Server : addCommandHandler("Create", function ( element , cmd , item ) local Text = tostring ( item ) if ( Text ) then CreateTextItem ( element, 5000, 255, 255, 0, 5,Text ) end end ) صفحة الوظيفة على الويكي : CreateTextItem و السلام عليكم و رحمة الله وبركآتة .. Link to comment
PaiN^ Posted April 26, 2013 Share Posted April 26, 2013 CreateTextItem Server : Function السلام عليكم و رحمة الله وبركاتة .. آخبآركم آن شاء الله آلكل بـ صحة و سلآمةة .. اليوم حبيت اطرح وظيفة مفيدهـ و تسهل عليكـ بـ حيث تقدر تسوي كلام بـكل سهولة وبسآطة تآبع الامثلة و السآينتكس # Function Syntax : [color=#FF8000]CreateTextItem[/color] bool CreateTextItem ( player playerToAdd , time, int red = 255, int green = 255, int blue = 255, float scale = 1, string text, [ float x, float y, string alignX = "left", string alignY = "top"] ) Required Arguments playerToAdd: The player that should observe the textdisplay. time: The number of times you want to the remove The textdisplay ,number of milliseconds (the minimum is 50)(1000 milliseconds = 1 second) red: A value between 0 and 255 indicating how red the text should be. green: A value between 0 and 255 indicating how green the text should be. blue: A value between 0 and 255 indicating how blue the text should be. scale: A floating point value indicating the scale of the text. The default is 1.0, which is around 12pt. text: A string of text you want to display Optional Arguments x: A floating point number between 0.0 and 1.0 indicating how far across the screen the text should be shown, as a percentage of the width, from the left hand side. y: A floating point number between 0.0 and 1.0 indicating how far down the screen the text should be shown, as a percentage of the height, from the top. scale: A floating point value indicating the scale of the text. The default is 1.0, which is around 12pt. alignX: A string representing the X-alignment of the text. ("left", "center", "right") alignY: A string representing the Y-alignment of the text. ("top", "center", "bottom") Source Function : function CreateTextItem ( player, time, r, g, b, scale, text, x, y, alignX, alignY) if not player or not time or not text then return end if not tonumber(r) and not tonumber(g) and not tonumber(b) then r, g, b = 255, 0, 0 end if not scale then scale = 1 end if ( isElement( player ) and type ( text ) == 'string' and tonumber( time) ) then local Display = textCreateDisplay () local newtextItem = textCreateTextItem ( text, x or 0.5, y or 0.5, 2, r, g, b, 255, scale, alignX or "center", alignY or "center" ) textDisplayAddText ( Display, newtextItem ) textDisplayAddObserver ( Display, player ) setTimer(textDestroyTextItem, time, 1, newtextItem) setTimer(textDestroyDisplay, time, 1, Display) end end Exmple | مثال Server : addCommandHandler("Create", function ( element , cmd , item ) local Text = tostring ( item ) if ( Text ) then CreateTextItem ( element, 5000, 255, 255, 0, 5,Text ) end end ) صفحة الوظيفة على الويكي : CreateTextItem و السلام عليكم و رحمة الله وبركآتة .. ! وظيفة رائعة فوق الصفر وأصغر من 255 r, g, b بس المفروض تتحقق من إن قيم Link to comment
iPrestege Posted April 26, 2013 Share Posted April 26, 2013 CreateTextItem Server : Function السلام عليكم و رحمة الله وبركاتة .. آخبآركم آن شاء الله آلكل بـ صحة و سلآمةة .. اليوم حبيت اطرح وظيفة مفيدهـ و تسهل عليكـ بـ حيث تقدر تسوي كلام بـكل سهولة وبسآطة تآبع الامثلة و السآينتكس # Function Syntax : [color=#FF8000]CreateTextItem[/color] bool CreateTextItem ( player playerToAdd , time, int red = 255, int green = 255, int blue = 255, float scale = 1, string text, [ float x, float y, string alignX = "left", string alignY = "top"] ) Required Arguments playerToAdd: The player that should observe the textdisplay. time: The number of times you want to the remove The textdisplay ,number of milliseconds (the minimum is 50)(1000 milliseconds = 1 second) red: A value between 0 and 255 indicating how red the text should be. green: A value between 0 and 255 indicating how green the text should be. blue: A value between 0 and 255 indicating how blue the text should be. scale: A floating point value indicating the scale of the text. The default is 1.0, which is around 12pt. text: A string of text you want to display Optional Arguments x: A floating point number between 0.0 and 1.0 indicating how far across the screen the text should be shown, as a percentage of the width, from the left hand side. y: A floating point number between 0.0 and 1.0 indicating how far down the screen the text should be shown, as a percentage of the height, from the top. scale: A floating point value indicating the scale of the text. The default is 1.0, which is around 12pt. alignX: A string representing the X-alignment of the text. ("left", "center", "right") alignY: A string representing the Y-alignment of the text. ("top", "center", "bottom") Source Function : function CreateTextItem ( player, time, r, g, b, scale, text, x, y, alignX, alignY) if not player or not time or not text then return end if not tonumber(r) and not tonumber(g) and not tonumber(b) then r, g, b = 255, 0, 0 end if not scale then scale = 1 end if ( isElement( player ) and type ( text ) == 'string' and tonumber( time) ) then local Display = textCreateDisplay () local newtextItem = textCreateTextItem ( text, x or 0.5, y or 0.5, 2, r, g, b, 255, scale, alignX or "center", alignY or "center" ) textDisplayAddText ( Display, newtextItem ) textDisplayAddObserver ( Display, player ) setTimer(textDestroyTextItem, time, 1, newtextItem) setTimer(textDestroyDisplay, time, 1, Display) end end Exmple | مثال Server : addCommandHandler("Create", function ( element , cmd , item ) local Text = tostring ( item ) if ( Text ) then CreateTextItem ( element, 5000, 255, 255, 0, 5,Text ) end end ) صفحة الوظيفة على الويكي : CreateTextItem و السلام عليكم و رحمة الله وبركآتة .. ! وظيفة رائعة فوق الصفر وأصغر من 255 r, g, b بس المفروض تتحقق من إن قيم لآ عآيدي : ) اللي بـ يستخدمها اذا مآشتغل اللون يتحول لـ آحمر تلقآئي .. 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