Jump to content

Search the Community

Showing results for tags 'position'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title





  1. How to get the weapon position we are currently holding?
  2. Iae rapaziada, seguinte fiz um code simples só para aprender melhor tabela, até agora estava tudo normal criando as markers, a mensagem na tela e tudo mais.... porém agora estou com o seguinte problema: São 3 markers cada uma tem uma cadeira do lado. O que tenho em mente é que quando o player hitar uma das markers binde a tecla E, ao pressiona-la ele é colocado sobre a cadeira em que ele esta próximo. Mas no sistema atual o problema é que ele não reconhece qual cadeira é! Quero saber como eu posso fazer uma verificação para saber se a marker é da cadeira [1], [2] ou [3]. Code: local posChairs = { [1] = {1579.4000244141,-1675.8000488281 ,15.199999809265}, -- cadeira interrogado (suspeito) 1 [2] = {1580, -1677.5, 15.199999809265}, -- cadeira interrogado (suspeito) 2 [3] = {1582.0999755859, -1676.3000488281, 15.199999809265}, -- -- cadeira interrogador (policial) } local chairTable = {} function resStart() for i, chair in ipairs(posChairs) do chairTable[i] = createMarker(chair[1], chair[2], chair[3], "cylinder", 1.2, 255,0, 0, 100) outputChatBox(tostring(chairTable[i])) addEventHandler("onMarkerHit", chairTable[i], hittingMk) addEventHandler("onMarkerLeave", chairTable[i], leavingMk) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), resStart) function resStopCircle() if chairTable[i] then destroyElement(chairTable[i]) chairTable[i] = nil outputChatBox(tostring(chairTable[i])) end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), resStopCircle) function hittingMk (element, md) if (md) then if getElementType(element) == "player" then outputChatBox("hitou") exports.inMarkerMsg:create(element, "pressione E para sentar") end end end function leavingMk (element, md) if (md) then if getElementType(element) == "player" then outputChatBox("saiu") exports.inMarkerMsg:delete(element) end end end Obs: estou ciente que se eu criar 3 variáveis e 3 eventos uma para cada cadeira dará certo (já testei e consegui!), porém irei criar mais cadeiras além de utilizar esse sistema em outras coisas! fazendo um for com a tabela (chairTable), percebi que há uma edentação um "prefixo" e um "valor": for k,v in pairs(chairTable) do outputChatBox("chairTable "..tostring(k)..", "..tostring(v)) end Retorna: chairTable 1, userdata: 0x7289 chairTable 2, userdata: 0x728c chairTable 3, userdata: 0x728f Tentei fazer uma verificação com if dessa forma (porém sem exito) : if chairTable[1] then outputChatBox("hitou1") elseif chairTable[2] then outputChatBox("hitou2") elseif chairTable[3] then outputChatBox("hitou3") end Será que tem como eu especificar a cadeira sem ter que criar para cada cadeira(marker), um evento e uma variável?
  3. This is the code: local now = getTickCount() local x,y = interpolateBetween(one, one1, 0, two, two1, 0, (now - start) / ((start + 2500) - start), "Linear") local now2 = getTickCount() local x2,y2 = interpolateBetween(asd, asd1, 0, fgh, fgh1, 0, (now2 - start2) / ((start2 +2500) - start2), "Linear") if right == false then dxDrawRectangle(x, (sy_/2-20) * ym, 3* xm, 40 * ym,tocolor(255,255,255,255)) else dxDrawRectangle(x2, (sy_/2-20) * ym, 3* xm, 40 * ym,tocolor(255,255,255,255)) end -- if x >= 1063 and x <= 1073 and right == false then test = true elseif x >= 1089 and x <= 1099 and right == false then test = true elseif x >= 1158 and x <= 1172 and right == false then test = true elseif x >= 1212 and x <= 1232 and right == false then test = true elseif x >= 1276 and x <= 1293 and right == false then test = true elseif x >= 1423 and x <= 1433 and right == false then test = true elseif x >= 1476 and x <= 1487 and right == false then test = true else test = false end i want change the test to true when the rectangle is in the granted position, but how can i get the momentary position of the dx rectangle?
  4. I want to render a rectangle to the cursor, but the rectangle too far from the cursor.. How to fix this in my code? code: local sx_, sy_ = 1920, 1080 local sx__, sy__ = guiGetScreenSize() local xm, ym = sx__/sx_, sy__/sy_ function render() local screenx, screeny = getCursorPosition() dxDrawRectangle((sx_-687) * xm * screenx, (sy_/2+70) * ym * screeny, 170 * xm, 25 * ym,tocolor(255,181,64,80)) end addEventHandler("onClientRender",root,render) the problem:
  5. ### UPDATE ### Added a GUI to customize the functions, also some dxDraw functions were added, so now the chat wont be flooded anymore. screenshot: Hi there. About the resource: So basically this script gives you the ability to save, load and delete multiple warps, with an extra feature of calculating the actual map's duration, it's made for DM race gamemode (for mappers, map testers and trainers). it's pretty useful and accurate when it comes to loading warps, also time calculation is pretty reliable. --Commands: -- /sw Save Warp -- /lw Load Warp -- /dw Delete Warp -- /resetWarps Delete all warps -- /duration Calculat the map's duration if you ran into any trouble, checkout the github page: https://github.com/Sagr7/PositionSaver/ ..maybe it's already solved there! Download MTA:SA Resources Community: https://community.multitheftauto.com/index.php?p=resources&amp;s=details&amp;id=15931 Github: https://github.com/Sagr7/PositionSaver/ if you found any bug, feel free to leave a comment.
  6. Olá senhores. Bom, estou precisando fazer um objeto apontar para outro como se ele estivesse fazendo um Look At. Mas não sei como calcular o ângulo da rotação Z com base nas posições. Exemplo. Objeto A está na posição 0, 0, 0. Objeto B está na posição 1, 1, 0. Ilustrações: Aplicando o Look At no Objeto A para o B, deve fazer o objeto A "mirar" no Objeto B, colocando a rotação Z do objeto A em 315. Mas como calculo isso? Obs: A rotação é com base nas posições, não importa a rotação do objB.
  7. Hello there. Me and my friend tried to make a script that makes a spoiler on a vehicle moving. If the vehicle is going above 100km/h the spoiler will change its position. We are using setVehicleComponentPosition. The problem is that only the player who's driving the car can see it moving. Is there any way that it will be visible for everybody on the server?
  8. I want create a dxdraw rectangle and text on the map. But how to make this possible?
  9. Hello! I am trying to do a boundary system based on coordinates, so no col shapes or anything. Unfortunately I'm not that good at math, but I tried doing it based on found results on the internet. My problem is that this whole script is not working how it should, check it for yourself, it has debug outputs and visible markers for corners and the center. Why does the width and height return a much bigger number than the calculatedX and calculatedY? Why does the calculatedX and calculatedY return always the same? Why does the width and height change values as I move around? I would be really grateful if somebody could help me, this is for a community project, so others would be too! Here's my current full code: Global: customBoundaries = { -- this boundary is between the big brown building(s) and the skatepark on the road in LS ["test"] = { point1 = {x = 1842.2908935547, y = -1412.469360351}, point2 = {x = 1856.8596191406, y = -1412.555664062}, point3 = {x = 1851.5925292969, y = -1436.5225830078}, point4 = {x = 1842.0438232422, y = -1424.5217285156}, }, } Client: local debugEnabled = true function sum(n) return ((n+1) * n) / 2 end function isElementWithinBoundary(element, boundary) if element and isElement(element) then local elementX, elementY, elementZ = getElementPosition(element) boundary = tostring(boundary) if boundary and type(boundary) == "string" then if customBoundaries and customBoundaries[boundary] then local corner1 = {customBoundaries[boundary].point1.x, customBoundaries[boundary].point1.y} local corner2 = {customBoundaries[boundary].point2.x, customBoundaries[boundary].point2.y} local corner3 = {customBoundaries[boundary].point3.x, customBoundaries[boundary].point3.y} local corner4 = {customBoundaries[boundary].point4.x, customBoundaries[boundary].point4.y} local centerX, centerY = (corner1[1] + corner2[1] + corner3[1] + corner4[1])/4, (corner1[2] + corner2[2] + corner3[2] + corner4[2])/4 local originX, originY = elementX - corner1[1], elementY - corner1[2] local width = math.sqrt((corner2[1] - originX)^2 + (corner2[2] - originY)^2) local height = math.sqrt((corner4[1] - originX)^2 + (corner4[2] - originY)^2) local calculatedX = originX * (corner2[1] - originX)/width + originY * (corner2[2] - originY)/height local calculatedY = originX * (corner4[1] - originX)/width + originY * (corner4[2] - originY)/height outputChatBox("X: " .. math.floor(calculatedX) .. " | width: " .. math.floor(width)) outputChatBox("Y: " .. math.floor(calculatedY) .. " | height: " .. math.floor(height)) if (0 <= calculatedX and calculatedX <= width) and (0 <= calculatedY and calculatedY <= height) then outputChatBox("XD") end if debugEnabled then for points, coordinates in pairs(customBoundaries[boundary]) do local cornerMarker = createMarker(coordinates.x, coordinates.y, getGroundPosition(coordinates.x, coordinates.y, elementZ), "cylinder", 2, 140, 245, 20, 150) local centerMarker = createMarker(centerX, centerY, getGroundPosition(centerX, centerY, elementZ)+2, "arrow", 1, 245, 140, 20, 150) end end end end end end isElementWithinBoundary(localPlayer, "test") Here's the calculation I was trying to copy and make it work based on: https://math.stackexchange.com/a/190257 I hope you understand my problem, thank you for your reply in advance!
  10. I want create a script, which tp a player to me, and teleport me to a player, like in admin panel, just with command. How to make this? For example: /tpto playername , and /tpme playername. And when i teleport a player to me, the player get out from vehicle
  11. Hello forums! to the current script: I created a boat (vehicle) and attached a pirateship to it. On the pirateship there are some doors attached. I'm using following function to interact with the objects: addEvent("onPlayerInteraction", true) addEventHandler("onPlayerInteraction", server.root, function() local nearest = getNearest(source, "object", 5) -- is working if (nearest) then outputChatBox("object found", source) local id = getElementData(nearest, "action") if (id) then local action = server.actions[id] action(source, nearest) outputChatBox("object found with id"..id, source) else outputChatBox("object found with no id", source) end else outputChatBox("no object found", source) end end) If the ship is created (and not moved) everything works fine. As soon as the ship is moved the function outputs "no object found". Is this a known bug or am I'm missing something?
  12. Hello again, I'm trying to spawn the player onto an element. This element has a non-fixed rotation. I'm just wondering if the function getPointFromDistanceRotation isn't enough to do this? Player details can be found here and the ships details are here I'm currently using this snippet (to try) to get the explained result: addCommandHandler("boat", function(player, cmd) local x, y, z = getElementPosition(player) local _, _, r = getElementRotation(player) outputChatBox("player pos: "..x..","..y..","..z..","..r, player) local ship = createShip(x, y, z, r) -- returns model of pirateship local x, y, z = getElementPosition(ship) local _, _, r = getElementRotation(ship) outputChatBox("ship pos: "..x..","..y..","..z..","..r, player) local x, y = getPointFromDistanceRotation(x - 0.1, y - 2.7, 5, r) -- offset included outputChatBox("new player pos: "..x..","..y..","..z..","..r, player) setElementPosition(player, x, y, 43.7) end) What am I'm doing wrong? Do I need to calculate the offset coordinates extra? Greetings, Maurize
  13. function test() setElementPosition ( mark, pos.x,pos.y,pos.z ) end addEventHandler("onMarkerHit", mark, test) this is the code. if i hit the marker, the element position change for all players.. how to fix this? sorry for my bad english.
  14. This is the code: When i type twice " /asd " the marker position does not change.. How to fix this?
  15. I want create a script, which create a marker with random position, from a table. How to make this?
  16. Hi all, I'm in search for a component/library having positioning controls like on the pic shown. Here's a samp's "Attached object editor" screenshot, but I've seen the same solutions being 100% lua-implemented on several MTA (many of them were not that "professionally built") servers, this "editor mode" looked the same everywhere, so I guess there could be an open-source issue.
  17. The resource starts, but the bot does not spawn. function bot () team = createTeam ("AngryBots", 255,255,255) exports [ "slothBot" ]:spawnBot ( 2002.5241699219,1546.9384765625,13.5859375, 90, 124, 0, 0, 29, "waiting", true ) end addCommandHandler("bots",bot) <meta> <info author="Falke" version="2.0.0" type="misc" name="angrybots" description="This script will add Silent Hill to San Andreas" /> <script src="server.lua" type="server" /> <include resource="slothbot" /> </meta> Why does not the bot spawn?? Please, help me! Neither the "nemesi1" script is working now (it worked when i played MTA years ago...). I don't know what is happening ;-; *nemesi1: https://community.multitheftauto.com/index.php?p=resources&s=details&id=5722
  18. How can I move a vehicle up to a certain point by having it follow the mta streets?
  19. Hello, I would be that many servers that include modifications on vehicles, would agree with this suggestion. getVehicleExhaustPosition would get the current position of exhaust on vehicle, setVehicleExhaustPosition would change the position to correct place (to fit modifications on vehicles, such as adding custom bumpers or so), also setVehicleExhaustType for changing type, for example Infernus has only "exhaust" node in DFF file, but displays as two exhausts on each side, mirrored by axis of car. By changing type it would change to only one exhaust, or two. I don't really know how this works in handling, maybe it could be worked on somehow. Cheers, NoHear.
  20. colShape = createColCuboid( -2061.63379, 1096.16113, 53, 30.0, 25.0, 25.0 ) addEventHandler( "onColShapeHit", colShape, function( hitElement, dimension, thePlayer ) if not ( dimension ) then return false end if( isElement( hitElement) and getElementType( hitElement ) == "player" ) then local accName = getAccountName ( getPlayerAccount ( hitElement ) ) if not( isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) ) then local veh = getPedOccupiedVehicle(thePlayer) if (veh) then setElementPosition(veh, -2052.28589, 1087.36926, 55.71875 ) else setElementPosition(thePlayer, -2052.28589, 1087.36926, 55.71875 ) end outputChatBox("#FFffFFTe ide nem jöhetsz be! Ki lettél rugva a helyről.", thePlayer, 255, 255, 255, true) end end end) what wrong?
  21. Hi! I want to create a fuel system. But I don't know how to calculate the cap's position. I know, that I can do it with getElementPosition, getElementRotation and Offset. But how?
  22. I have a question, can I just move the elements of the default interface? Or do I always have to create others from them? I just want to get, for example: getElementHealth And move it! In fact, I would like to do this with everyone, such as: getTime getPedWeapon getPedArmor getPedAmmoInClip getPedTotalAmmo getPedOxygenLevel getPlayerMoney getPlayerWantedLevel I do not want to create another, I want the standard, you know?
  23. Is it possible to set the players position inside a vehicle? I tried it bit nothing happened
  • Create New...