Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 22/02/20 in all areas

  1. Temporary bans can't be appealed. Next time, don't upload resources to the community that contain backdoors. Wait for the ban to expire
    2 points
  2. 2 points
  3. bengines provides custom engine sounds for vehicles. The resource is not focused to be ultra realistic, it is designed to use for casual servers. Not useful for me anymore so sharing with community. Used on old project. Sounds are copyrighted content not owned by me. Features: ready to use, chooses the best engine for vehicle depending on handling! easy to customize & expand for Lua programmers 30 soundpacks for vehicles (buses, bikes, sport cars etc.) stable code with quite high performance used on server with 600 players ALS effect (exhaust flames) Turbo (satisfying whistle and blow-off sounds) Videos: https://streamable.com/n7k40 https://streamable.com/lp14t https://streamable.com/q5e9g Download: Github: https://github.com/brzys/bengines (feel free to send pull requests) Community: to-do For programmers: --[[ Element datas used by resource [array] vehicle:engine - stores basic info about engine type, sound pack etc. (synced) [string] vehicle:type - used for engine calculation, useful for servers. Available: Bus, Truck, Sport, Casual, Muscle, Plane, Boat, Motorbike (synced) [string] vehicle:fuel_type - customized for each engine. Useful for servers. Available: "diesel", "petrol" (synced) You can use setElementData(vehicle, "vehicle:upgrades", {turbo=true, als=true}) to add turbo or ALS. --]] --[[ Exported functions --]] exports.bengines:getVehicleRPM(vehicle) -- returns RPM of given vehicle exports.bengines:getVehicleGear(vehicle) -- returns current gear of given vehicle exports.bengines:toggleEngines(bool) -- true / false, restore GTA engine sounds
    1 point
  4. Dear MTA community, I have been spending my last 8 weeks on mathematical problems. One of them is the 3D Frustum-Plane intersection that is used by GPUs to draw triangles onto your screen. If you want to learn more about this please consider reading this thread. Promotional Video: https://www.youtube.com/watch?v=RQy3Q4Xe110 Prerequisites This tutorial is aimed at people who are capable of scientific thinking and are willing to playfully learn with Lua code. To execute steps in this tutorial minimal knowledge of Linear Algebra and Lua is required. Required MTA Resource: https://github.com/quiret/mta_lua_3d_math Description of the math Imagine that we have got a frustum and a plane in a 3D room described by coordinates plus their boundaries. By intersecting both you obtain all coordinates on a screen along with their depth values. Now think about how your vision works. You see distant objects smaller than closer ones. You rotate your eyes to angles of vision. If we were to put this concept into terms of math we could say: the plane of vision is bigger in the distance than in close proximity. The frustum is a seamless row of vision planes starting from the pyramid tip to the bottom. How to use the MTA Resource Just download the GitHub repository into a folder of your MTA Resources, name it "math_3d_nonlin" and start it. You can execute the following commands for quick testing: send_bbuf: draws a simple depth test draw_model: draws the DFF file "gfriend.dff" Now we have got the basics out of the way. Time to start coding. Please create a new "_math_test.Lua" script file in the resource and include it server-side at the bottom of meta.xml. Tutorial: software rendering a plane on screen Open your _math_test.Lua and include the following code: local viewFrustum = createViewFrustum( createVector(0, 0, 0), -- position createVector(10, 0, 0), -- right createVector(0, 0, 10), -- up createVector(0, 20, 0) -- front ); local plane = createPlane( createVector(-3, 10, -3), createVector(6, 0, 0), createVector(0, 0, 6) ); local function task_draw_scene(thread) local bbuf = create_backbuffer(640, 480, 255, 255, 0, 50); local dbuf = createDepthBuffer(640, 480, 1); local time_start = getTickCount(); do local gotToDraw, numDrawn, numSkipped = draw_plane_on_bbuf(viewFrustum, bbuf, dbuf, plane, true); if ( gotToDraw ) then outputDebugString( "drawn " .. numDrawn .. " pixels (skipped " .. numSkipped .. ")" ); end end local time_end = getTickCount(); local ms_diff = ( time_end - time_start ); outputDebugString( "render time: " .. ms_diff .. "ms" ); taskUpdate( 1, "creating backbuffer color composition string" ); local bbuf_width_ushort = num_to_ushort_bytes( bbuf.width ); local bbuf_height_ushort = num_to_ushort_bytes( bbuf.height ); local pixels_str = table.concat(bbuf.items); local bbuf_string = pixels_str .. ( bbuf_width_ushort .. bbuf_height_ushort ); taskUpdate( false, "sending backbuffer to clients (render time: " .. ms_diff .. "ms)" ); local players = getElementsByType("player"); for m,n in ipairs(players) do triggerClientEvent(n, "onServerTransmitImage", root, bbuf_string); end outputDebugString("sent backbuffer to clients"); end addCommandHandler( "testdraw", function(player) spawnTask(task_draw_scene); end ); Result: Try executing the "testdraw" command. At the top of file you see the definition of our frustum cone as well as a plane. By calling the function "draw_plane_on_bbuf" we put color information into bbuf for exactly the pixels that make up the rectangle. If you change the plane definition to... local plane = createPlane( createVector(-2, 10, -4), createVector(6, 0, 3), createVector(-2, 0, 6) ); you instead get this image: Try changing around the coordinates of frustum and plane to obtain different pictures! Tutorial: software rendering a triangle on screen Take the same code as in the tutorial above but change line 19 to: local gotToDraw, numDrawn, numSkipped = draw_plane_on_bbuf(viewFrustum, bbuf, dbuf, plane, true, "tri"); This way we have changed the primitive type to triangle (rectangle is the default). Try executing the "testdraw" command again to inspect the new result! Tutorial: drawing a DFF file onto screen Instead of writing triangle definitions by hand we can take them from a DFF file instead. DFF files are storage of triangle and vertex information along with 3D rotation and translation information. By extacting the triangles from the DFF file we can put them into our algorithm to software-render them! Here is a related excerpt from math_server.Lua: local modelToDraw = false; do local modelFile = fileOpen("gfriend.dff"); if (modelFile) then modelToDraw = rwReadClump(modelFile); fileClose(modelFile); end end local function task_draw_model(thread) local bbuf = create_backbuffer(640, 480, 255, 255, 0, 50); local dbuf = createDepthBuffer(640, 480, 1); local time_start = getTickCount(); local num_triangles_drawn = 0; if (modelToDraw) then -- Setup the camera. local geom = modelToDraw.geomlist[1]; local mt = geom.morphTargets[1]; local centerSphere = mt.sphere; local camPos = viewFrustum.getPos(); camPos.setX(centerSphere.x); camPos.setY(centerSphere.y - 3.8); camPos.setZ(centerSphere.z); local camFront = viewFrustum.getFront(); camFront.setX(0); camFront.setY(5 + centerSphere.r * 2); camFront.setZ(0); local camRight = viewFrustum.getRight(); camRight.setX(centerSphere.r * 2); camRight.setY(0); camRight.getZ(0); local camUp = viewFrustum.getUp(); camUp.setX(0); camUp.setY(0); camUp.setZ(centerSphere.r * 2); local triPlane = createPlane( createVector(0, 0, 0), createVector(0, 0, 0), createVector(0, 0, 0) ); local vertices = modelToDraw.geomlist[1].morphTargets[1].vertices; local triangles = modelToDraw.geomlist[1].triangles; local tpos = triPlane.getPos(); local tu = triPlane.getU(); local tv = triPlane.getV(); for m,n in ipairs(triangles) do taskUpdate( m / #triangles, "drawing triangle #" .. m ); local vert1 = vertices[n.vertex1 + 1]; local vert2 = vertices[n.vertex2 + 1]; local vert3 = vertices[n.vertex3 + 1]; tpos.setX(vert1.x); tpos.setY(vert1.y); tpos.setZ(vert1.z); tu.setX(vert2.x - vert1.x); tu.setY(vert2.y - vert1.y); tu.setZ(vert2.z - vert1.z); tv.setX(vert3.x - vert1.x); tv.setY(vert3.y - vert1.y); tv.setZ(vert3.z - vert1.z); local gotToDraw, numDrawn, numSkipped = draw_plane_on_bbuf(viewFrustum, bbuf, dbuf, triPlane, false, "tri"); if (gotToDraw) and (numDrawn >= 1) then num_triangles_drawn = num_triangles_drawn + 1; end end end local time_end = getTickCount(); local ms_diff = ( time_end - time_start ); (...) end The code first loads a DFF file called "gfriend.dff" and stores it inside the "modelToDraw" variable. Once you execute the "draw_model" command the code looks up the first geometry in the DFF file and fetches all triangles associated with it. The rendering camera is set up to point at the middle of the model. Then all triangles are drawn one-by-one. https://twitter.com/rplgn/status/1230650912345067520 Try swapping the DFF file for another one, like biker.dff, and examine the results! Maybe extract a different DFF file from GTA:SA and replace gfriend.dff with that one. External references: math calculation on paper example: https://imgur.com/gallery/rLvln3X German thread on mta-sa.org: https://www.mta-sa.org/thread/38693-3d-frustum-ebene-schneidung-in-Lua/ Do you have any questions related to the math or the implementation? Do not shy away from asking! I want to provide you with as much insight as I can.
    1 point
  5. I solved the problem as you said thank you. But I have another question, and I will ask him in a few hours. Thank you for your help.
    1 point
  6. I solved the problem as you said thank you. But I have another question, and I will ask him in a few hours. Thank you for your help.
    1 point
  7. local screenW, screenH = guiGetScreenSize() function draw() dxDrawImage((screenW - 400) / 2, (screenH - 200) / 2, 100, 100, "img/arrow.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage((screenW + 200) / 2, (screenH - 200) / 2, 100, 100, "img/arrow.png", 180, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage((screenW - 100) / 2, (screenH + 200) / 2, 100, 100, "img/scissors.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end function barbershop(status) if not type(status) == "boolean" then return false end if status == true then addEventHandler("onClientRender", root, draw) elseif status == false then removeEventHandler("onClientRender", root, draw) end end addEvent( "showPanel", true ) addEventHandler( "showPanel", localPlayer, barbershop) Não crie variáveis para funções de renderização (dxDrawImage, dxDrawRectangle, dxDrawText etc). Elas devem ficar dentro de um bloco de função, sendo assim, basta, depois, adicionar ou remover o evento onClientRender nesta função, que no caso acima é a draw.
    1 point
  8. If you have McAfee anti-virus, disable it and reinstall MTA Otherwise please download and run MTADiag and follow the instructions. Press 'n' when asked. Post any Pastebin URL MTADiag gives you
    1 point
  9. English seems great to me, haven't even noticed it wasn't your native language... But as for how to figure out what parameters a event has: Let's say we want to know what parameters come with the OnPlayerWasted Event We first look up the event on the wiki: https://wiki.multitheftauto.com/wiki/OnPlayerWasted Look for where it says: Parameters You may rename these parameters to anything you want, but will always be the same So on this example: onPlayerWasted(totalAmmo,killer,killerWeapon,bodypart,stealth) Let's change the parameter names to be like: onPlayerWasted(candy,bird,sun,rock,tools) candy will still be the total ammo, bird will be the killer element if any, sun would still be the weapon used for the kill, so on and so forth... You're going to have to look into this wiki, search these forums and google search Lua to figure everything out. This is how I learned, but every now and then I won't be able to find anywhere on how to do this or that and so I finally make a thread for it
    1 point
  10. source He is the marker not player if (source == infourdragons) then and here error on event hit marker addEventHandler("onHitMarker", player, "saythis") It must be like this addEventHandler("onMarkerHit", root, saythis)
    1 point
  11. infourdragons = createMarker (2019.76953125, 1007.0116577148, 9.7203125, "cylinder", 1, 255, 0, 0, 153) function saythis (player) -- Should consider adding the 2nd parameter for future use and renaming the player parameter to something more related such as element if (player == infourdragons) then -- The player is not infourdragons and never will be, you must be confusing this as checking the player touching infourdragons or something. Instead check if player is an actual player element AND if source (The Marker) is infourdragons outputChatBox ("What are you doing?", player, true) -- This would work currently, but what if player is a vehicle instead of a player? Should rename the player parameter for that reason end end addEventHandler("onHitMarker", player, "saythis") -- onHitMarker is wrong, you meant onMarkerHit. getRootElement() should be used instead of the player parameter, but unsure if player could or even should be used. Never tried, always gone with getRootElement() on all my Handlers
    1 point
  12. Because you are using player, but player is not defined in this function anywhere. However, with onMarkerHit(hitElement, matchingDimension), the first parameter is the element that hit the marker which in this case is likely the player: infourdragons = createMarker (2019.76953125, 1007.0116577148, 9.7203125, "cylinder", 1, 255, 0, 0, 153) -- Coords for a spot next to the doors of the casino, on the outside. function enteredDragons(hitElement, matchingDimension) -- When anything hits the marker (players, objects, vehicles, etc.) it becomes "hitElement" if (source == infourdragons and getElementType (hitElement) == "player") then -- Making sure the element is a player setElementInterior (hitElement, 0) setElementPosition (hitElement, 2018.9376220703, 1017.0843505859, 996.875 ) -- Coords for a spot next to the doors of the casino, on the inside. setElementRotation (hitElement, 0, 0, 90) outputChatbox ("Entraste al Casino 'Four Dragons'", hitElement, true) end end addEventHandler ("onMarkerHit", root, enteredDragons) There are other options you may take, one is simply just changing that first parameter to player (But this may confuse you down the road because more than just a player can trigger the event) Another option is using onPlayerMarkerHit(markerHit, matchingDimension), source would then be the player that hit the marker
    1 point
  13. Alguns mods da game mode [play] contém include pra puxa outros resources e os força a ligar Que no meu caso eu desativei o scoreboard do mta.config e mesmo assim volta a ligar. o jeito é olhar os meta.xml de cara resource dentro da gm PLAY
    1 point
  14. 0 Interior is outside, but your z position is probably too high (1025.732323227) You would end up teleporting somewhere in the sky and then just falling back down to the ground... I don't recall what the Z limit for Interior 0 (Outside) is, but if you were to change below that limit, it would likely teleport you then. Change the Z to 500.0, it will likely work, but you'll also likely fall to your death as well
    1 point
  15. Vale lembrar que os jogadores não fazem download dos resources desligados.
    1 point
  16. السلام عليكم ورحمة الله وبركاته مرحبا بكم اعزاء اعضاء mta اهلا بكم في انست هوست - الشركة الرائدة من بين الشركات والارخص سعرا الان ولفترة محدودة!!! إنست_هوست تقدم تخفيض بنسبة 50 % على الخوادم لاول شهر بمناسبة مرور سنة على افتتاح الشركة ♥♥ ♥ ☺ وش الفايدة من الخادم؟ : تقريبا تقدر تحط عليه اي شي - تقدر تركب العاب زي . سيرفرات MTA - سيرفرات ماين كرافت - سيرفرات ماتين 2 - مواقع , والمزيد - ايضا نقدم تركيب لوحات Open game panel - tc admin او تقدر تفتح شركة تبيع منها ليه #إنست_هوست ؟ لان انست هوست الشركة الاولى عربي الي تقدم تخفيضات من بشكل دوري وايضا خوادمنا من افضل الخوادم الموجودة في السوق بشهادة كثير من العملاء =============================== طريقة الشراء وتفعيل الخصم ؟ تدخل على الموقع المذكور ادناه وتطلب الخادم وتعبي المعلومات وبعدها راح تجيك كلمة " تطبيق الرمز الترويجي - شاهد الصورة ادناه وتحط الكود هذا [ VPS50 ] ====================================== طرق الدفع : من جميع انحاء العالم : ( باي بال - بايزا - سكريل \ كلهم يقبلو فيزا + ماستركارد ) ).☺ مصر : (بطاقات فودافون / فودافون كاش ).☺ السعودية: (بطاقات سوا - تحويل بنكي راجحي ).☺ العراق : (بطاقات اسياسيل ).☺ الجزائر: (بطاقات أوريدو ).☺ الأردن : ( زين او زين كاش ) .☺ للدخول على الموقع : اضغط هنا ليتم تحويلك على الموقع شكرا لكم جميعا #إنست_هوست حياكم الله جميعها ===============================
    1 point
  17. Lua is very safe in terms of sandboxing. It doesn't seem to beat Lua in performance. MTA just needed a language that was safe and easy to embed, Lua wins in this case, that's why we are using Lua and not Python.
    1 point
  18. I want to create a "system" to update any xml (or only the vehicles.xml) without restart the Freeroam. Like, i create a second resource with alls xml's ex: resouce1: freeroam, resource2 = xmllist, then i put in xml options in freeroam, the ':xmllist/vehicles.xml' for example. (everything alright) But, when i restart the xmllist, do not update the freeroam, and i want create a command or a way to "refresh" the xml/gridlist. I found a way, but it "duplicate" the freeroam window. function testeeetalkei() wndCreateVehicle = { 'wnd', text = 'Create vehicle', width = 300, controls = { { 'lst', id='vehicles', width=280, height=340, columns={ {text='Vehicle', attr='name'} }, rows={xml=':xmllist/vehicles.xml', attrs={'id', 'name'}}, onitemdoubleclick=createSelectedVehicle, DoubleClickSpamProtected=true, }, {'btn', id='create', onclick=createSelectedVehicle, ClickSpamProtected=true}, {'btn', id='close', closeswindow=true} } } wndMain = { 'wnd', text = 'FR GUI', x = 10, y = 150, width = 280, controls = { {'lbl', text='Local player'}, {'br'}, {'btn', id='kill', onclick=killLocalPlayer}, {'btn', id='skin', window=wndSkin}, {'btn', id='anim', window=wndAnim}, {'btn', id='weapon', window=wndWeapon}, {'btn', id='clothes', window=wndClothes}, {'btn', id='playergrav', text='grav', window=wndGravity}, {'btn', id='warp', window=wndWarp}, {'btn', id='stats', window=wndStats}, {'btn', id='bookmarks', window=wndBookmarks}, {'br'}, {'chk', id='jetpack', onclick=toggleJetPack}, {'chk', id='falloff', text='fall off bike', onclick=toggleFallOffBike}, {'br'}, {'chk', id='disablewarp', text='disable warp', onclick=toggleWarping}, {'chk', id='disableknife', text='disable knifing', onclick=toggleKnifing}, {'chk', id='antiram', text='anti-ramming (vehicle ghostmode)', onclick=toggleGhostmode}, {'br'}, {'lbl', text='Pos:'}, {'lbl', id='xpos', text='x', width=45}, {'lbl', id='ypos', text='y', width=45}, {'lbl', id='zpos', text='z', width=45}, {'btn', id='setpos', text='map', window=wndSetPos}, {'btn', id='setinterior', text='int', window=wndSetInterior}, {'br'}, {'br'}, {'lbl', text='Vehicles'}, {'br'}, {'lbl', text='Current:'}, {'lbl', id='curvehicle'}, {'br'}, {'btn', id='createvehicle', window=wndCreateVehicle, text='create'}, {'btn', id='repair', onclick=repairVehicle}, {'btn', id='flip', onclick=flipVehicle}, {'btn', id='upgrades', window=wndUpgrades}, {'btn', id='color', onclick=openColorPicker}, {'btn', id='paintjob', window=wndPaintjob}, {'br'}, {'chk', id='lightson', text='Lights on', onclick=forceLightsOn}, {'chk', id='lightsoff', text='Lights off', onclick=forceLightsOff}, {'br'}, {'br'}, {'lbl', text='Environment'}, {'br'}, {'btn', id='time', window=wndTime}, {'chk', id='freezetime', text='freeze', onclick=toggleFreezeTime}, {'btn', id='weather', window=wndWeather}, {'btn', id='speed', window=wndGameSpeed} }, oncreate = mainWndShow, onclose = mainWndClose } createWindow(wndMain, true) hideAllWindows() end addCommandHandler('test', testeeetalkei) this way, i restart the xmllist resource and /test and works, but duplicate the window, anyone know how to do this without duplicate or create a function to delete old window or only update the xml? idk how to do it (note: this code is in fr_client.Lua (clientside)) (note2: found some functions that work with xml: function _buildWindow(wnd, baseWnd, parentWnd) -- at line 141 in gui.Lua -- some code... if wnd.rows then -- at line 227 if wnd.rows.xml then -- get rows from xml bindGridListToTable(wnd, not gridListHasCache(wnd) and xmlToTable(wnd.rows.xml, wnd.rows.attrs) or false, wnd.expandlastlevel or wnd.expandlastlevel == nil) else -- rows hardcoded in window definition bindGridListToTable(wnd, not gridListHasCache(wnd) and wnd.rows or false, false) end end --- etc.. end )
    0 points
  19. local tempoMensagem = 5 -- Tempo em minutos para aparecer a mensagem local enviarMensagem = { "#FFFFFFO banco cobrou #FFFF00{1} #FFFFFFda sua conta.", "#FFFFFFVocê perdeu #FFFF00{1} #FFFFFFquando estava a caminho do trabalho." } setTimer(function() for _, player in ipairs(getElementsByType("player")) do local value = math.random(100, 1000) takePlayerMoney(player, value) local randomMessage = enviarMensagem[math.random(1, #enviarMensagem)] outputChatBox(format(randomMessage, value), root, 255, 255, 255, true) end end, 60000 * tempoMensagem, 0) function format(s, ...) local result = s for k, v in ipairs({...}) do result = string.gsub(result, string.format("{%d}",k), v) end return result end
    0 points
×
×
  • Create New...