1337.Ibrahim Posted November 10, 2017 Share Posted November 10, 2017 --client addEventHandler("onClientGUIClick",resourceRoot,function ( ) if ( source == show ) then triggerServerEvent("showimg",localPlayer) end end) --server addEvent( "showimg", true ) addEventHandler( "showimg", resourceRoot, function ( response ) fetchRemote("http://a.top4top.net/p_52221hhc1.jpg") if response ~= "ERROR" then triggerClientEvent("onClientGotImage", root, response ) end end) --client addEvent( "onClientGotImage", true ) addEventHandler( "onClientGotImage", resourceRoot, function( pixels ) if myTexture then destroyElement( myTexture ) end myTexture = dxCreateTexture( pixels ) end ) addEventHandler("onClientRender", root, function() if myTexture then local w,h = dxGetMaterialSize( myTexture ) dxDrawImage( 200, 100, w, h, myTexture ) end end ) Link to comment
iMr.WiFi..! Posted November 10, 2017 Share Posted November 10, 2017 addEvent( "showimg", true ) addEventHandler( "showimg", resourceRoot, function ( ) fetchRemote("http://a.top4top.net/p_52221hhc1.jpg", myCallback, "", false, source ) end ) function myCallback( responseData, errno, playerToReceive ) if errno == 0 then triggerClientEvent( playerToReceive, "onClientGotImage", resourceRoot, responseData ) end end 1 Link to comment
Rockyz Posted November 10, 2017 Share Posted November 10, 2017 4 minutes ago, iMr.WiFi..! said: addEvent( "showimg", true ) addEventHandler( "showimg", resourceRoot, function ( ) fetchRemote("http://a.top4top.net/p_52221hhc1.jpg", myCallback, "", false, source ) end ) function myCallback( responseData, errno, playerToReceive ) if errno == 0 then triggerClientEvent( playerToReceive, "onClientGotImage", resourceRoot, responseData ) end end السطر الثاني استبدل resourceRoot ب root Link to comment
iMr.WiFi..! Posted November 10, 2017 Share Posted November 10, 2017 Just now, #,+( _xiRoc[K]; > said: السطر الثاني استبدل resourceRoot ب root مافرقت لان احنا ما نستعمل السورس في الحالة ذي : ( Link to comment
Rockyz Posted November 10, 2017 Share Posted November 10, 2017 (edited) 8 minutes ago, iMr.WiFi..! said: مافرقت لان احنا ما نستعمل السورس في الحالة ذي : ( انت جرب وبتعرف السبب ___ جرب المثال هذا وبتشوفه مابيشتغل لكن اذا استبدلت 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..! Edited November 10, 2017 by #,+( _xiRoc[K]; > 1 Link to comment
1337.Ibrahim Posted November 10, 2017 Author Share Posted November 10, 2017 (edited) @iMr.WiFi..! @#,+( _xiRoc[K]; > يعطيكم العافية https://wiki.multitheftauto.com/wiki/CenterWindow استفسار اخير gui اليوزفل فنكشن ذا لدي اكس بعد ولا لل فقط ؟ Edited November 10, 2017 by Talis 1 Link to comment
iMr.WiFi..! Posted November 10, 2017 Share Posted November 10, 2017 8 minutes ago, Talis said: @iMr.WiFi..! @#,+( _xiRoc[K]; > يعطيكم العافية https://wiki.multitheftauto.com/wiki/CenterWindow استفسار اخير gui اليوزفل فنكشن ذا لدي اكس بعد ولا لل فقط ؟ الله يعافيك , شوف وش يرجع الفنكشن واحكم بنفسك ._. Link to comment
Rockyz Posted November 10, 2017 Share Posted November 10, 2017 10 minutes ago, Talis said: @iMr.WiFi..! @#,+( _xiRoc[K]; > يعطيكم العافية https://wiki.multitheftauto.com/wiki/CenterWindow استفسار اخير gui اليوزفل فنكشن ذا لدي اكس بعد ولا لل فقط ؟ gui فقط لكن تقدر تاخذ الطريقة وتسويها لل dx Link to comment
1337.Ibrahim Posted November 10, 2017 Author Share Posted November 10, 2017 22 minutes ago, #,+( _xiRoc[K]; > said: gui فقط لكن تقدر تاخذ الطريقة وتسويها لل dx function centerWindow (center_window) local sx, sy = dxGetScreenSize() local windowW, windowH = dxGetSize(center_window, false) local x, y = (screenW - windowW) /2,(screenH - windowH) /2 return dxSetPosition(center_window, x, y, false) end Like this huh? Link to comment
Rockyz Posted November 10, 2017 Share Posted November 10, 2017 11 minutes ago, Talis said: function centerWindow (center_window) local sx, sy = dxGetScreenSize() local windowW, windowH = dxGetSize(center_window, false) local x, y = (screenW - windowW) /2,(screenH - windowH) /2 return dxSetPosition(center_window, x, y, false) end Like this huh? زي كذا, ولكن بشرط ان الفنكشنات dxGetSize, dxSetPosition يكونون فنكشنات مفيدين, لأنه مافي فنكشن زي كذا اذا تبي مثال بعطيك مثال كيف تسوي كذا Link to comment
1337.Ibrahim Posted November 10, 2017 Author Share Posted November 10, 2017 11 minutes ago, #,+( _xiRoc[K]; > said: زي كذا, ولكن بشرط ان الفنكشنات dxGetSize, dxSetPosition يكونون فنكشنات مفيدين, لأنه مافي فنكشن زي كذا اذا تبي مثال بعطيك مثال كيف تسوي كذا عطني مثال Link to comment
Rockyz Posted November 10, 2017 Share Posted November 10, 2017 (edited) سويت لك الفنكشن عالسريع ادري في اشياء ناقصة لكن جرب : 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 ) Edited November 10, 2017 by #,+( _xiRoc[K]; > Link to comment
iMr.WiFi..! Posted November 10, 2017 Share Posted November 10, 2017 7 minutes ago, #,+( _xiRoc[K]; > said: سويت لك الفنكشن عالسريع ادري في اشياء ناقصة لكن جرب : 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 ( ) return itemsTable [ elm ] and itemsTable [ elm ] = nil 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 ) line 20 ( elm is nil ) 1 Link to comment
Rockyz Posted November 10, 2017 Share Posted November 10, 2017 1 minute ago, iMr.WiFi..! said: line 20 ( elm is nil ) كنت بكتب elm كتبت source Link to comment
Rockyz Posted November 10, 2017 Share Posted November 10, 2017 فيه خطأ بسيط لاحظته في سطر 26 استبدله بهذا function dxGetPosition ( d ) return itemsTable [ d ].x, itemsTable [ d ].y end 1 Link to comment
1337.Ibrahim Posted November 10, 2017 Author Share Posted November 10, 2017 اوله كل هالاكواد 1 Link to comment
1337.Ibrahim Posted November 10, 2017 Author Share Posted November 10, 2017 1 hour ago, iMr.WiFi..! said: line 20 ( elm is nil ) فيه خطأ في الدي بق ناقص ايند في سطر 20 Link to comment
Rockyz Posted November 10, 2017 Share Posted November 10, 2017 2 minutes ago, Talis said: فيه خطأ في الدي بق ناقص ايند في سطر 20 مافي ايند ناقص يمكن انت نسخت الكود القديم انا عدلته فوق المهم انا عدلته اكثر وضفت اضافات وصلحت بعض الأخطاء جرب : 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 ) Link to comment
1337.Ibrahim Posted November 10, 2017 Author Share Posted November 10, 2017 (edited) https://imgur.com/a/JX9fy @#,+( _xiRoc[K]; > Edited November 10, 2017 by Talis Link to comment
Rockyz Posted November 10, 2017 Share Posted November 10, 2017 3 minutes ago, Talis said: https://imgur.com/a/JX9fy @#,+( _xiRoc[K]; > شغال معي 100% 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