-
Posts
1,862 -
Joined
-
Days Won
8
Everything posted by Rockyz
-
جرب : local Table = { {name = '11', price = 100000}, {name = '111', price = 100000}, {name = 'B111', price = 100000}, {name = '2222', price = 100000}, {name = '33333', price = 100000}, }; for _, value in ipairs(Table) do local row = guiGridListAddRow(GUIEditor.gridlist[1]); guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, value['name'] or 'None', false, false) guiGridListSetItemText(GUIEditor.gridlist[1], row, 2, tostring(value['price'] or 0), false, false) end واذا ماضبط اطرح اكوادك
-
بأختصار toJSON يحول الجدول الى سترنق و fromJSON يحول السترنق الى تيبل (طبعا مو اي سترنق) و الأمثلة موجودة في الويكي
-
شغال معي 100%
-
مافي ايند ناقص يمكن انت نسخت الكود القديم انا عدلته فوق المهم انا عدلته اكثر وضفت اضافات وصلحت بعض الأخطاء جرب : local itemsTable = { }; function dxCreateWindow ( x, y, w, h, title, color, textColor, post ) assert ( type ( x .. y .. w .. h ) ~= 'number', 'Bad Argument @dxCreateWindow, position error' ) local title, color, post, textColor, elm = ( title and type ( title ) == 'string' ) and title or '', color or tocolor ( 255, 255, 255, 255 ), post or false, textColor or tocolor ( 255, 255, 255, 255 ), createElement ( 'newDX-WIN' ) itemsTable [ elm ] = { x = x, y = y, w = w, h = h, color = color, post = post, title = title, textColor = textColor, visible = false } return elm end addEventHandler ( 'onClientElementDestroy', resourceRoot, function ( ) if ( itemsTable [ source ] ) then itemsTable [ source ] = nil end return true end ) function dxSetVisible ( d, b ) if ( itemsTable [ d ] ) then local b = b or itemsTable [ d ].visible itemsTable [ d ].visible = b return true end end function dxGetVisible ( d ) return itemsTable [ d ].visible or false end function dxSetPosition ( d, x, y ) if ( itemsTable [ d ] ) then itemsTable [ d ].x = x itemsTable [ d ].y = y return true end end function dxGetPosition ( d ) return itemsTable [ d ].x, itemsTable [ d ].y end function dxSetSize ( d, w, h ) if ( itemsTable [ d ] ) then itemsTable [ d ].w = w itemsTable [ d ].h = h return true end end function dxGetSize ( d ) return itemsTable [ d ].w, itemsTable [ d ].h end function centerWindow (center_window) local sx, sy = guiGetScreenSize() local windowW, windowH = dxGetSize(center_window) local x, y = (sx - windowW) /2,(sy - windowH) /2 return dxSetPosition(center_window, x, y) end addEventHandler ( 'onClientRender', root, function ( ) for k, v in ipairs ( getElementsByType 'newDX-WIN' ) do if ( itemsTable [ v ].visible ) then dxDrawRectangle ( itemsTable [ v ].x, itemsTable [ v ].y, itemsTable [ v ].w, itemsTable [ v ].h, itemsTable [ v ].color, itemsTable [ v ].post ) dxDrawRectangle ( itemsTable [ v ].x, itemsTable [ v ].y, itemsTable [ v ].w, 20, tocolor ( 0, 0, 0, 255 ), itemsTable [ v ].post ) dxDrawText ( itemsTable [ v ].title, itemsTable [ v ].x, itemsTable [ v ].y, itemsTable [ v ].x + itemsTable [ v ].w, itemsTable [ v ].y + 20, itemsTable [ v ].textColor, 1, 'default-bold', 'center', 'center' ) end end end ) addEventHandler ( 'onClientResourceStart', root, function ( ) wnd = dxCreateWindow ( 0, 0, 500, 500, 'Hello', tocolor ( 255, 0, 0, 255 ), tocolor ( 255, 255, 255, 255 ), false ) centerWindow ( wnd ) dxSetVisible ( wnd, true ) end )
-
فيه خطأ بسيط لاحظته في سطر 26 استبدله بهذا function dxGetPosition ( d ) return itemsTable [ d ].x, itemsTable [ d ].y end
-
كنت بكتب elm كتبت source
-
سويت لك الفنكشن عالسريع ادري في اشياء ناقصة لكن جرب : local itemsTable = { }; function dxCreateWindow ( x, y, w, h, title, color, post ) assert ( type ( x .. y .. w .. h ) == 'number', 'Bad Argument @dxCreateWindow, position error' ) local title, color, post, elm = ( title and type ( title ) == 'string' ) or '', color or tocolor ( 255, 255, 255, 255 ), post or false, createElement ( 'newDX-WIN' ) itemsTable [ elm ] = { x = x, y = y, w = w, h = h, color = color, post = post, title = title, visible = false } return elm end addEventHandler ( 'onClientElementDestroy', resourceRoot, function ( ) if ( itemsTable [ source ] ) then itemsTable [ source ] = nil end return true end ) function dxSetVisible ( d, b ) if ( itemsTable [ d ] ) then local b = b or itemsTable [ d ].visible itemsTable [ d ].visible = b return true end end function dxGetVisible ( d ) return itemsTable [ d ].visible or false end function dxSetPosition ( d, x, y ) if ( itemsTable [ d ] ) then itemsTable [ d ].x = x itemsTable [ d ].y = y return true end end function dxGetPosition ( d ) return itemsTable [ d ].x, itemsTable [ d ].x end function dxSetSize ( d, w, h ) if ( itemsTable [ d ] ) then itemsTable [ d ].w = w itemsTable [ d ].h = h return true end end function dxGetSize ( d ) return itemsTable [ d ].w, itemsTable [ d ].h end function centerWindow (center_window) local sx, sy = guiGetScreenSize() local windowW, windowH = dxGetSize(center_window) local x, y = (screenW - windowW) /2,(screenH - windowH) /2 return dxSetPosition(center_window, x, y) end addEventHandler ( 'onClientRender', root, function ( ) for k, v in ipairs ( getElementsByType 'newDX-WIN' ) do if ( itemsTable [ v ].visible ) then dxDrawRectangle ( itemsTable [ v ].x, itemsTable [ v ].y, itemsTable [ v ].w, itemsTable [ v ].h, itemsTable [ v ].color, itemsTable [ v ].post ) dxDrawText ( itemsTable [ v ].title, itemsTable [ v ].x, itemsTable [ v ].y, itemsTable [ v ].x + itemsTable [ v ].w, itemsTable [ v ].y + 15, tocolor ( 255, 255, 255, 255 ), 1, 'default-bold', 'center', 'center' ) end end end ) addEventHandler ( 'onClientResourceStart', root, function ( ) wnd = dxCreateWindow ( 0, 0, 500, 500, 'Hello', tocolor ( 255, 0, 0, 255 ), false ) centerWindow ( wnd ) dxSetVisible ( wnd, true ) end )
-
زي كذا, ولكن بشرط ان الفنكشنات dxGetSize, dxSetPosition يكونون فنكشنات مفيدين, لأنه مافي فنكشن زي كذا اذا تبي مثال بعطيك مثال كيف تسوي كذا
-
gui فقط لكن تقدر تاخذ الطريقة وتسويها لل dx
-
انت جرب وبتعرف السبب ___ جرب المثال هذا وبتشوفه مابيشتغل لكن اذا استبدلت resourceRoot ب root بيشتغل : -- #Client addEventHandler ( 'onClientResourceStart', resourceRoot, function ( ) triggerServerEvent ( 'k_OUT', localPlayer ) end ) -- #Server addEvent ( 'k_OUT', true ) addEventHandler ( 'k_OUT', resourceRoot, function ( ) outputChatBox ( 'Done', source ) end ) @iMr.WiFi..!
-
السطر الثاني استبدل resourceRoot ب root
-
مثال آخر من دون استعمال تيبل ولا تايمر local waitingTime = 3 -- الثواني addCommandHandler ( 'justAtest', function ( plr, cmd ) if ( getTickCount ( ) - ( lastTick or 0 ) >= ( waitingTime * 1000 ) ) then outputChatBox ( 'Done', plr, 0, 255, 0, true ) lastTick = getTickCount ( ); else outputChatBox ( 'Please wait ', plr, 255, 0, 0 , true ) end end )
-
صحيح, انتبهت لهذا الشي و كنت بعدلها لكن انا صححت الأخطاء فقط
-
جرب : vehicleArabic = { [ 604 ] = 'كامري 2015', [ 585 ] = 'سوناتا 2015' }; addEventHandler ( 'onClientVehicleEnter', root, function ( ) local carNum = cars [ getElementModel ( source ) ] if ( carNum ) then outputChatBox ( carNum ) end end )
-
https://wiki.multitheftauto.com/wiki/Control_names fire
-
وعليكم السلام سكربت خرافي عندي اقتراحات بسيطة بس 1- ضيف اصوات التنقيات 2- ضيف في زر 8 انك لما تضغط تنقل واحد داخل الماركر اليك وأنت تروح مكانه وبيكون السكربت افضل وشكراً على الأهداء
-
جرب : addEventHandler ( 'onResourceStart', resourceRoot, function ( ) local createSQL = executeSQLQuery ( 'CREATE TABLE IF NOT EXISTS `getBACK1` (playerSerial, Health)' ) if ( createSQL ) then outputDebugString ( 'Successfully Created Health SQL Table', 3, 0, 255, 0 ) else outputDebugString ( 'Failed to Create Health SQL Table', 1, 0, 255, 0 ) end end ) addEventHandler ( 'onPlayerQuit', root, function ( ) local checkData = executeSQLQuery ( 'SELECT * FROM `getBACK1` WHERE playerSerial = ? ', getPlayerSerial ( source ) ) local Health = getElementHealth (source ) local dataText = { 'UPDATE `getBACK1` SET Health = ? WHERE playerSerial = ?', Health, getPlayerSerial ( source ) }; if ( type ( checkData ) == 'table' and #checkData == 0 or not checkData ) then dataText = { 'INSERT INTO `getBACK1` (playerSerial, Health) VALUES(?, ?)', getPlayerSerial ( source ), Health }; end executeSQLQuery ( unpack ( dataText ) ); end ); addEventHandler( 'onPlayerJoin', root, function( ) local check = executeSQLQuery ( 'SELECT * FROM `getBACK1` WHERE playerSerial = ?', getPlayerSerial ( source ) ); if ( check and type ( check ) == 'table' and #check > 0 ) then setElementHealth ( source, check[1].Health ) end end );
-
وعليكم السلام انا ماقصد تحطيم بس ماشوف انه فيه داعي انك تسوي شرح لمثل هذي الوضائف + و حتى لو بتسوي وضح على الأقل وش يسوي الفنكشن ووش يرجع + في خطأ في الأمثلة انت حاطه كذا getAccountSerial ( 'Talis' ) و من المفترض انه يكون كذا local acc = getAccount ( 'Talis' ); if ( acc ) then getAccountSerial ( acc ) end
-
مافهمت وش تبي بالضبط بس سويت لك فنكشنين مفيدين وأمثلة عليهم : function getStringFromSplitChar ( text, splitChar ) local splitTable = { }; for _, v in pairs ( split ( text, splitChar ) ) do table.insert ( splitTable, v ) end return splitTable end function isText ( text, splitChar, textToFind ) local rBool for _, v in pairs ( split ( text, splitChar ) ) do if ( v == textToFind ) then rBool = true break end end return rBool end addCommandHandler ( 'Check', function ( p, _, ... ) if ( #{...} >= 1 ) then local newText = table.concat ( {...}, ' ' ); if ( isText ( newText:lower ( ), ', ', 'done' ) ) then outputChatBox ( 'Done.', p, 0, 255, 0, true ) else outputChatBox ( 'Please Write done.', p, 255, 0, 0, true ) end end end ); local a = getStringFromSplitChar ( 'Hello, Wow, ok, yes', ', ' ) for k, v in ipairs ( a ) do print ( v .. ( k == #a and '.' or ';' ) ) end --[[ Hello; Wow; ok; yes. ]]