Jump to content

mouamle

Members
  • Posts

    303
  • Joined

  • Last visited

Everything posted by mouamle

  1. local PTeam = getPlayerTeam( player ) if ( PTeam ~= "اسم تيم الشرطه" ) then guiSetVisible() end
  2. This event is triggered each time the user scrolls his mouse scroll on top of a GUI element. is there a way to make it trigger even if the mouse is not on top of GUI element ?
  3. لا علمني اصلحه بعد
  4. http://www.lua.org/cgi-bin/demo روح حط الكود وجرب إيش يطلعلك , وفي شيء قهرني print(name..' don't insert') كل ما احطها print(name..' don\'t insert') المنتدى يخربها . بإختصار t = {} function insertname(name) local num = math.random(1,5) if t[num] then print(name .."don't insert") return false else print(name..' insert '..num) t[num] = name return true end end repeat until insertname('dddd') repeat until insertname('dddd1') repeat until insertname('dddd2') repeat until insertname('dddd3') repeat until insertname('dddd4') متى عدلت الكود
  5. force -- قوة الضربه target -- الهدف يشتغل بس اذا استخدمت heat seeking rockets. rotX, rotY, rotZ -- الدوران velX, velY, velZ: -- السرعه في كل محور model -- نوع القذيفه
  6. الفكره موجوده بالأكواد فوك طبقها بس على SQL مو تيبل ;-;
  7. سويته تيبل تكدر تسويه SQL مثال Lua t = { } function insertName ( name1 ) rand = math.random(5, 10) if ( t[tostring(rand)] == nil ) then t[tostring(rand)] = name1 else rand = rand * math.random(5, 500) t[tostring(rand)] = name1 end end insertName("Mouamle") insertName("Mouamle2") insertName("Mouamle3") for k, v in pairs(t) do print(k, v) end مثال Mta TempTable = { } addCommandHandler( "sign", function ( p ) local pName = getPlayerName(p) local randNum = math.random(0, 1024) if ( TempTable[tostring(randNum)] == nil ) then TempTable[tostring(randNum)] = pName else randNum = randNum * math.random(5, 255) TempTable[tostring(randNum)] = pName end end )
  8. وين الجزء اللي فيه trigger ؟ أحتمال مستخدمها مرتين
  9. يوتيوب ولا واحد عربي شارح برمجه MTA أو LUA فكرت مره أشرح بس لهجتي عراقيه مو الكل يفهمها
  10. تستخدم math.random(min, max) وتسوي جدول تحفظ فيه القيمه واللاعب ومن تسوي القيمه لللاعب الثاني تتحقق اذا كانت موجوده داخل الجدول تزيدها قيمه عشوائيه واذا مو موجوده تظيفها للجدول
  11. Event https://wiki.multitheftauto.com/wiki/OnMarkerHit function https://wiki.multitheftauto.com/wiki/SetElementPosition
  12. in programming : { the sky is your limit } but in your case the sky is too low ;-;
  13. نشرت موضوع قبل يوم عن الفنكشنات اللي سويتها كانت مجرد تجربه وشفتها نجحت *-* ف عدلت عليها وظفت فنكشنات أكثر الأحداث "onMButtonClicked" -- من تضغط على زر "onMFrameClicked" -- من تضغط على شريط العنوان للنافذه "onMTextBoxClicked" -- واضح من أسمه "onKeyTyped" -- من ينكتب الحرف داخل ال textBox "onKeyPressed" -- من تظغط على الحرف سواء تمت كتابته أو لا Frame --[[ createFrame( x - أحداثي x للأطار y - أحداثي y للأطار w - عرض الأطار h - أرتفاع الأطار Title - عنوان الأطار Color - لون الأطار TitleBarColor - لون شريط العنوان withX - أذا تريد يحط علامة أكس لأخفاء الاطار ) ]] function createFrame( x, y, w, h, Title, Color, TitleBarColor, withX ) local isVisableX = true; local isMouseInsideX = false; local FrameTrigger = 0; local TempComponents = {}; MFrame = { x = 0, y = 0, w = 400, h = 250, Title = "Frame", Color = tocolor( 120, 120, 120, 150 ), Color = tocolor( 120, 120, 120, 255 ), type = "Frame", isX = false, components = { }, isMouseOnTitleBar = function () mouseX, mouseY = getCursorPosition(); if ( not isCursorShowing ( ) ) then return false; end local Sx, Sy = guiGetScreenSize( ) mx = mouseX * Sx; my = mouseY * Sy; --outputChatBox( y .. " : " .. h + .. ", " .. mx ) if ( mx > x and mx <= x + w + 10 and my > y and my <= y + 15 ) then return true; end return false; end, clear = function () for k,v in pairs(MFrame.components) do if ( v.getText() ~= "X" ) then v.setVisable(false) end end end, setTitle = function ( newTitle ) Title = newTitle; end, setX = function ( newX ) x = newX; end, setY = function ( newY ) y = newY; end, setVisable = function ( visable ) isVisableX = visable; end, render = function () if ( isVisableX ) then dxDrawRectangle( x, y, w, h, Color, false) dxDrawRectangle( x, y, w, 30, TitleBarColor, false) dxDrawText( Title, x + 5, y + 7) for k,v in pairs(MFrame.components) do v.setOfset(x, y) if ( v.type ~= "TextBox" ) then if ( v.isMouseInside() ) then v.highlight(30); else v.dehighlight(); end end v.render(); end end end, add = function ( comp ) comp.setOfset(x, y) table.insert(MFrame.components, comp); TempComponents = MFrame.components; end, click = function ( button, state ) if ( not isMouseInsideX ) then return; end if ( FrameTrigger == 0 ) then triggerEvent( "onMFrameClicked", getRootElement(), button, state ) FrameTrigger = 1; setTimer( function ( ) FrameTrigger = 0; end, 150, 1 ) end end } function close( button, state, text ) if ( text == "X" and button == "left" and state == "down" ) then isVisableX = false; showCursor( false ) end end function createX( x, y, w, h) if ( withX ) then Color = TitleBarColor + 10; TextColor = TitleBarColor - 10; x = createButton( w - 30, 0, 30, 30, "X", Color, textColor ) MFrame.add(x); addEventHandler( "onMButtonClicked", getRootElement( ), close ) end end function Cliced( button, state ) end function updae() isMouseInsideX = MFrame.isMouseOnTitleBar(); end function create() addEvent( "onMButtonClicked", true ) addEvent( "onMFrameClicked" ) MFrame.x = x; MFrame.y = y; MFrame.w = w; MFrame.h = h; MFrame.Title = Title; MFrame.Color = Color; MFrame.TitleBarColor = TitleBarColor; createX(x, y, w, h); addEventHandler( "onClientClick", getRootElement(), MFrame.click ) addEventHandler( "onClientRender", getRootElement(), updae ) addEventHandler( "onMFrameClicked", getRootElement( ), Cliced ) return MFrame; end return create(); end Button --[[ createButton( x - أحداثي x للزر y - أحداثي y للزر w - عرض الزر h - أرتفاع الزر text - النص اللي يضهر داخله Color - لون مربع الزر textColor - لون النص ) ]] function createButton( x, y, w, h, text, Color, textColor ) local xOfset = 0; local yOfset = 0; local isVisableX = true; local mouseInside = false; local swap = Color; local swapCheck = 0; local test = 0; local MButton = { x = 0, y = 0, w = 80, h = 20, text = "Button", isVisable = isVisableX, textColor = tocolor( 236, 240, 241, 255 ), Color = tocolor( 231, 76, 60, 150 ), type = "Button", render = function () if ( isVisableX == true ) then dxDrawRectangle( x + xOfset, y + yOfset, w, h, Color ) dxDrawText( text, ( (x + xOfset) + (w/2) ) - (string.len(text)*3), ((y + yOfset) - 7) + (h/2) ) end end, isMouseInside = function () mouseX, mouseY = getCursorPosition(); if ( not isCursorShowing ( ) ) then return false end local Sx, Sy = guiGetScreenSize( ) x2 = Sx * mouseX; y2 = Sy * mouseY; --outputChatBox(y + yOfset .. " : " .. h + yOfset + 40 .. ", " .. math.floor(y2)) --outputChatBox(x + xOfset .. " : " .. w + xOfset + x .. ", " .. math.floor(x2)) if ( x2 >= x + xOfset and x2 <= w + xOfset + x and y2 >= y + yOfset and y2 <= h + yOfset + y) then return true; end return false; end, highlight = function ( value ) if ( swapCheck == 0 ) then swap = Color; swapCheck = 1; Color = Color + value end end, dehighlight = function () Color = swap; swapCheck = 0; end, setVisable = function ( visable ) isVisableX = visable; end, getVisable = function ( ) return isVisableX; end, setTextColor = function ( color ) textColor = color; end, setTextColorRGBA = function ( r, g, b, a ) textColor = tocolor( r, g, b, a ) end, getText = function ( ) return text; end, setText = function ( text2 ) text = text2; end, setColor = function ( Color2 ) Color = Color2; end, setColorRGBA = function ( r, g, b, a ) Color = tocolor( r, g, b, a ) end, getColorRGBA = function ( ) end, setOfset = function ( ofx, ofy ) xOfset = ofx; yOfset = ofy; end, setX = function (x2) x = x2 end, getX = function () return x; end, setY = function (y2) y = y2 end, getY = function () return y; end, setW = function (w2) w = w2 end, getW = function () return w; end, setH = function (h2) h = h2 end, getH = function () return h; end, Click = function ( button, state ) if ( not mouseInside ) then return; end if ( test == 0 ) then triggerEvent( "onMButtonClicked", getRootElement(), button, state, text, x, y, w, h ) test = 1; Color = Color + 30; setTimer( function () test = 0; Color = Color - 30; end, 150, 1 ) end end, } local update = function () mouseInside = MButton.isMouseInside(); end local create = function () MButton.x = x; MButton.y = y; MButton.w = w; MButton.h = h; MButton.text = text; MButton.Color = Color; MButton.textColor = textColor; addEventHandler( "onClientClick", getRootElement(), MButton.Click ) addEventHandler( "onClientRender", getRootElement(), update ) return MButton; end return create() end Label --[[ text - النص x - أحداثي x y - أحداثي y Color - اللون ]] function createLabel( text, x, y, Color) local xOfset = 0; local yOfset = 0; local isVisable = true; MLabel = { x = 0, y = 0, text = "Label", Color = tocolor( 120, 21, 0, 255 ), type = "Label", render = function () if ( isVisable ) then dxDrawText( text, x + xOfset, y + yOfset, 0, 0, Color ) end end, setVisable = function( visable ) isVisable = visable; end, setOfset = function ( ofx, ofy ) xOfset = ofx; yOfset = ofy; end, setText = function ( Text ) text = Text; end, getText = function () return text; end, setX = function ( newX ) x = newX; end, getX = function ( ) return x; end, setY = function ( newY ) y = newY; end, getY = function ( ) return y; end, isMouseInside = function ( ) end, dehighlight = function ( ) end } function create() MLabel.x = x; MLabel.y = y; MLabel.text = text; MLabel.Color = Color; return MLabel; end return create(); end راح تفهم تقريباً نص الفنكشنات من المثال Example local fps = false function getCurrentFPS() return fps end local function updateFPS(msSinceLastFrame) fps = (1 / msSinceLastFrame) * 1000 end addEventHandler("onClientPreRender", root, updateFPS) local Frame; local b1; local b2; local b3; local l1; function renderer ( ) Frame.render(); end function init() showCursor(true) ButtonColor = tocolor( 255, 76, 60, 255 ) textColor = tocolor( 236, 240, 241, 255 ) b1 = createButton( 10, 40, 80, 40, "Button1", ButtonColor, textColor ) b2 = createButton( 200, 40, 80, 40, "Button2", ButtonColor, textColor ) b3 = createButton( 300, 200, 80, 40, "Button3", ButtonColor, textColor ) l1 = createLabel( "Hello", 20, 200, tocolor( 0, 0, 0, 255) ) FrameColor = tocolor( 231, 76, 60, 120 ) Frame = createFrame( 250, 250, 450, 250, "Frame", FrameColor, FrameColor, true ); Frame.add(b1) Frame.add(b2) Frame.add(b3) Frame.add(l1) addEventHandler ( "onClientRender", root, renderer ) setTimer( function () Frame.setTitle( "FPS : " .. math.floor(getCurrentFPS())) end, 250, 0 ) bindKey ( "F5", "down", function ( ) Frame.setVisable(true) showCursor( true ) end ) end addEventHandler ( "onClientResourceStart", resourceRoot, init ) ClickedX = 0; function Move( ) local screenx, screeny, worldx, worldy, worldz = getCursorPosition() local x, y = guiGetScreenSize( ) x2 = screenx * x; y2 = screeny * y; if ( Frame.isMouseOnTitleBar() ) then Frame.setX(x2 -10); Frame.setY(y2 -10); end end function ClickHandler( button, state, text, x, y, w, h) if ( text == "Button3" ) then Frame.clear(); elseif ( text == "Button1" ) then if ( button == "left" ) then l1.setText(text) l1.setX( l1.getX() + 10 ) else l1.setText(text) l1.setX( l1.getX() - 10 ) end end end addEvent( "onMButtonClicked" ) addEventHandler("onMButtonClicked", getRootElement(), ClickHandler) Result وهذي محاولتي ب TextBox اللي فشلت أذا عندك أمكانيه تصلحها صلحها : )
  14. كفووووو ابداااااااع لو يشتغل على حدث onClientGUIClick يكون افضل سويت أصدار جديد راح انشره بي نظام Event خاص أسمه onMButtonClick
  15. setElementData ( element theElement, string key, var value [, bool synchronize = true ] ) setElementData ( source, "Key1", "Value1" ) setElementData ( source, "Key2", "Value2" ) setElementData ( source, "Key3", "Value3" )
  16. حتى ما يجيب أسم اللاعب كل مره يمر بال loop : function OnPlayerACL ( player ) local accName = getAccountName ( getPlayerAccount ( player ) ) for _, v in ipairs ( Groups ) do if isObjectInACLGroup ("user."..accName, aclGetGroup ( v ) ) then triggerServerEvent(player,'ClrChat',player) end end end
  17. فنكشنات بسيطه ( لا لحظة مو بسيطه ;-; ) ألمهم dxFrame, dxButton الفنكشنات واضحه من عنوانها Frame function --[[ createFrame( x - أحداثي x للأطار y - أحداثي y للأطار w - عرض الأطار h - أرتفاع الأطار Title - عنوان الأطار Color - لون الأطار TitleBarColor - لون شريط العنوان ) ]] function createFrame( x, y, w, h, Title, Color, TitleBarColor ) MFrame = { x = 0, y = 0, w = 400, h = 250, Title = "Frame", Color = tocolor( 120, 120, 120, 150 ), Color = tocolor( 120, 120, 120, 255 ), components = { }, render = function () dxDrawRectangle( x, y, w, h, Color, false) dxDrawRectangle( x, y, w, 15, TitleBarColor, false) dxDrawText( Title, x + 5, y ) for k,v in pairs(MFrame.components) do v.render(); end end, add = function ( comp ) comp.setOfset(x, y) table.insert(MFrame.components, comp); end } function create() MFrame.x = x; MFrame.y = y; MFrame.w = w; MFrame.h = h; MFrame.Title = Title; MFrame.Color = Color; MFrame.TitleBarColor = TitleBarColor; return MFrame; end return create(); end Button function --[[ createButton( x - أحداثي x للزر y - أحداثي y للزر w - عرض الزر h - أرتفاع الزر text - النص اللي يضهر داخله Color - لون مربع الزر textColor - لون النص ) ]] function createButton( x, y, w, h, text, Color, textColor ) xOfset = 0; yOfset = 0; isVisableX = true; local MButton = { x = 0, y = 0, w = 80, h = 20, text = "Button", isVisable = isVisableX, textColor = tocolor( 236, 240, 241, 255 ), Color = tocolor( 231, 76, 60, 150 ), render = function () if ( isVisableX == true ) then dxDrawRectangle( x + xOfset, y + yOfset, w, h, Color ) dxDrawText( text, ( (x + xOfset) + (w/2) ) - (string.len(text)*3), ((y + yOfset) - 7) + (h/2) ) end end, setVisable = function ( visable ) isVisableX = visable; end, setTextColor = function ( color ) textColor = color; end, setTextColorRGBA = function ( r, g, b, a ) textColor = tocolor( r, g, b, a ) end, getText = function ( ) return text; end, setText = function ( text2 ) text = text2; end, setColor = function ( Color2 ) Color = Color2; end, setColorRGBA = function ( r, g, b, a ) Color = tocolor( r, g, b, a ) end, setOfset = function ( ofx, ofy ) xOfset = ofx; yOfset = ofy; end, setX = function (x2) x = x2 end, getX = function () return x; end, setY = function (y2) y = y2 end, getY = function () return y; end, setW = function (w2) w = w2 end, getW = function () return w; end, setH = function (h2) h = h2 end, getH = function () return h; end } local create = function () MButton.x = x; MButton.y = y; MButton.w = w; MButton.h = h; MButton.text = text; MButton.Color = Color; MButton.textColor = textColor; return MButton; end return create() end من تسوي زر راح تتوفر عندك الفنكشنات التاليه render() -- ما راح تحتاجها أصلاً setX(newX) -- تغيير أحداثي x للزر setText(newText) -- تغيير النص setOfset(xOfset, yOfset) -- في الأغلب ما راح تحتاجها بس مجرد تغير احداثيات ال x,y اللي راح يبدأ منها الزر ( ما اتوقع وصلتها صح ) setTextColorRGBA(r, g, b, a) -- تغيير لون النص getH() -- ترجع قيمة ارتفاع الزر setH(newHeight) -- تغيير ارتفاع الزر setVisable(visable) -- أضهار الزر وأخفائه setColor(Color) -- تغيير لون الزر setW(newWidth) -- تغيير عرض الزر getY() -- ترجع y للزر setY(newY) -- تغيير قيمة y للزر setColorRGBA(r, g, b, a) -- تغيير لون الزر getX() -- ترجع x للزر getW() -- ترجع عرض الزر setTextColor(Color) -- تغيير لون النص getText() -- ترجع النص داخل الزر وبالنسبه للأطار عندك هذي الفنكشنات render() -- ما راح تحتاجها add(component) -- أضافة العنصر كـ الزر أو بقية العناصر اللي راح اسويها مستقبلاً : ) طريقة الأستعمال local Frame; -- نسوي متغير أساسي للأطار local b1; -- ومتغير للزر function renderer ( ) Frame.render(); -- عرض الأطار end function init() ButtonColor = tocolor( 231, 76, 60, 255 ) -- نسوي متغير يعبر عن اللون textColor = tocolor( 236, 240, 241, 255 ) -- متغير ثاني يعبر عن لون الخط b1 = createButton( 10, 20, 80, 40, "Test Test", color, textColor ) -- أنشاء الزر FrameColor = tocolor( 231, 76, 60, 120 ) -- نسوي لون للأطار Frame = createFrame( 400, 400, 450, 250, "Frame", color, color ); -- أنشاء الأطار Frame.add(b1) -- أضافة الزر الى الأطار addEventHandler ( "onClientRender", root, renderer ) end addEventHandler ( "onClientResourceStart", resourceRoot, init ) الناتج أذا عندك أي استفسار أكدر اجاوبك
  18. ف أي قسم أنشره ؟ شكراً <3 window أو Frame ما يفرق متعود على JFrame, Java اها طيب مشكور علي توضيحك + بما انها فنكنشات للاستعمال حطها في موضوع useful Arab functions او موضوع خاص بك في قسم البرمجة شكراً أمسح هذا الموضوع لو انتضر المشرف يغلقه ؟
  19. ف أي قسم أنشره ؟ شكراً <3 window أو Frame ما يفرق متعود على JFrame, Java
×
×
  • Create New...