Jump to content

Forums

  1. Multi Theft Auto: San Andreas 1.x

    1. Support for MTA:SA 1.x

      HELP! HELP! Need help? Post here.

      55.4k
      posts
    2. User Guides

      These guides are a good place to start learning how to achieve certain things within MTA in an efficient and well mannered way.

      11
      posts
    3. Open Source Contributors

      This space is for contributors to discuss the development of MTA. No user suggestions/support.

      1.3k
      posts
    4. Suggestions

      Suggestions and requests go here. Please note that actual feature requests must be filed on our GitHub.

      7.7k
      posts
    5. Ban appeals

      Use this forum to appeal your GLOBAL MTA:SA bans. Permanent bans only - appeals for timed ones (eg. 24 hours) will be refused.

      Do not use it for appealing server-specific bans as we do not have power over these specific servers.

      4.6k
      posts
  2. General MTA

    1. News

      News and updates on Multi Theft Auto.

      9.8k
      posts
    2. Media

      User-made screens and movies go here.

      4.5k
      posts
    3. Site/Forum/Discord/Mantis/Wiki related

      Share your comments & concerns about our services.

      5.6k
      posts
    4. MTA Chat

      MTA related chat that is NOT support related!

      2.1k
      posts
    5. 330.8k
      posts
  3. MTA Community

    1. Scripting

      All Lua scripting topics related to Multi Theft Auto.

      261.7k
      posts
    2. Maps

      Discussions for maps on various gamemodes.

      13.4k
      posts
    3. Resources

      Everything else about resources.

      28.7k
      posts
    4. Other Creations & GTA modding

      This section includes things such as GUI themes, forum userbars, user-created MTA logos, etc. Also contains topics which cover general GTA modding areas that can be used in MTA, such as modelling.

      2.5k
      posts
    5. Competitive gameplay

      Discussions about various MTA-related competitive gameplay events. Also gang (clan) forums.

      26.7k
      posts
    6. Servers

      Looking for a server to play on? Looking for someone to host your server? Looking for a place to discuss with other server owners? Here's where to look.

      15.8k
      posts
  4. Other

    1. General

      Non-MTA discussions. Anything you want.

      38.1k
      posts
    2. Multi Theft Auto 0.5r2

      Discussion regarding Multi Theft Auto 0.5r2 for GTAIII and Vice City.

      684
      posts
    3. Third party GTA mods

      Showcase for single player mods and requests.

      814
      posts
  5. Archive

    1. 144k
      posts
    2. Trash

      These posts have broken forum rules. They are stored here temporarily so offending users can see what they have done wrong.

      3.4k
      posts
  • Posts

    • Hi. Small heads up that version 1.5 is out, and work has already begun towards version 1.6. The gamemode is currently discounted - Find all information in the Discord provided Thank you.
    • See: https://wiki.multitheftauto.com/wiki/FindRotation3D
    • hey, i am trying to make my custom radar, i used HUD mask shader in order to apply a circle shader to map, now my problem is how can i calculate the blips correct position on the map? it should be depend on the map zoom level, uvpostion and uvrotation, i also want to skip rendering the blips that are out of the map texture rendering part   local radarConfig = { x = 250, y = 1080 / 2, width = 300, height = 300, defaultZoom = 13, } local currentZoom = radarConfig.defaultZoom -- Start with a default zoom level local targetZoom = currentZoom -- Initialize target zoom to the current zoom function getElementSpeed(theElement, unit) -- Check arguments for errors assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") local elementType = getElementType(theElement) assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")") assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)") -- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit)) -- Setup our multiplier to convert the velocity to the specified unit local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456) -- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit return (Vector3(getElementVelocity(theElement)) * mult).length end addEventHandler("onClientResourceStart", resourceRoot, function() hudMaskShader = dxCreateShader("hud_mask.fx") maskTexture = dxCreateTexture("images/circle_mask.png") radarTexture = dxCreateTexture("images/map.png") -- Check everything is ok bAllValid = hudMaskShader and radarTexture and maskTexture if not bAllValid then outputChatBox( "Could not create some things. Please use debugscript 3" ) else dxSetShaderValue( hudMaskShader, "sPicTexture", radarTexture ) dxSetShaderValue( hudMaskShader, "sMaskTexture", maskTexture ) end end ) addEventHandler("onClientRender", root, function() if not bAllValid then return end drawRadar() end ) function drawRadar() -- -- Transform world x,y into -0.5 to 0.5 -- local x, y = getElementPosition(localPlayer) x = (x) / 6000 y = (y) / -6000 dxSetShaderValue(hudMaskShader, "gUVPosition", x, y) -- -- Zoom -- local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and getElementSpeed(vehicle, "m/s") > 20 then targetZoom = radarConfig.defaultZoom - 5 else targetZoom = radarConfig.defaultZoom end -- Smoothly transition to the target zoom level currentZoom = currentZoom + (targetZoom - currentZoom) * 0.05 -- Adjust the 0.1 value for speed of transition -- Set the shader value with the current zoom local scaleValue = 1 / currentZoom dxSetShaderValue(hudMaskShader, "gUVScale", scaleValue, scaleValue) -- -- Rotate to camera direction - OPTIONAL -- local _, _, camrot = getElementRotation(getCamera()) dxSetShaderValue(hudMaskShader, "gUVRotAngle", math.rad(-camrot)) -- -- Draw the radar map -- dxDrawImage(radarConfig.x, radarConfig.y, radarConfig.width, radarConfig.height, hudMaskShader, 0, 0, 0, tocolor(255, 255, 255, 230)) for i, blip in pairs(getElementsByType("blip")) do drawRadarBlip(blip) end end function drawRadarBlip(elm) -- this is where i am stuck end  
    • Good evening, Community! I need some help calculating an element's rotation based on the following matrix calculation: 'Point_B' is basically the point of which our player or vehicle element is facing towards, we draw a green "+" to show point_B's position on screen. Using processLineOfSight, we are able to show exactly where we're pointing to in the 3D world. The problem is, or what I would really like achieve in this example snippet is, rotating our test object (AK-47) so that it is pointing directly at "Point_B".    -- client.lua -- OOP true setElementPosition( localPlayer, -281.52420, 1539.13477, 75.35938 ) -- Test location local theObject = createObject( 355, -281.52420, 1539.13477, 75.35938, 0, 0, 0 ) -- Test object (AK-47) addEventHandler( "onClientRender", root, function ( ) -- CALCULATE "POINT_A" / "POINT_B" ---------------------------------------- local matrix = localPlayer:getMatrix( 0, 0, 0 ) local point_A = matrix:transformPosition( 0, 0, 0 ) local point_B = matrix:transformPosition( 0, 500, 0 ) local hit, x, y, z, element = processLineOfSight( point_A, point_B, true, true, true, false, false, false, false, true, localPlayer ) local hit_start = Vector3( x, y, z ) local point_B = hit and hit_start or point_B local scr = Vector2( getScreenFromWorldPosition( point_B ) ) ---------------------------------------- -- CALCULATE OBJECT ROTATION: -- Point at which I've lost my brain-cells ----------------------------------- local rotX, rotY, rotZ = math.random( 0, 360 ), math.random( 0, 360 ), math.random( 0, 360 ) -- current position of the final brain cell setElementRotation( theObject, rotX, rotY, rotZ ) -- rotate Test object (AK-47) to point to: "Point_B" ---------------------------------------- -- DRAW GREEN TARGET POINT AT: "Point_B" ---------------------------------------- if ( scr.length > 0 ) then dxDrawText( "+", scr - Vector2 ( 0, 0 ), 0, 0, tocolor ( 0, 255, 0, 255 ), 2, "default" ) end end )  
    • By showing the cursor: https://wiki.multitheftauto.com/wiki/ShowCursor Though setCameraMatrix might also be possible, but you will have to reset the camera.

Twitter Feed

×
×
  • Create New...