# Search the Community

Showing results for tags 'position'.

• ### Search By Tags

Type tags separated by commas.

### Forums

• 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

• 0 Replies

• 0 Views

Found 28 results

3. ## How to get the weapon position

How to get the weapon position we are currently holding?

5. ## [HELP] How to get the moving dx element position?

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?
6. ## [HELP] What wrong in this dx element?

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:

8. ## look at Como fazer um Look At na rotação Z?

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.
9. ## setVehicleComponentPosition not visible to other players

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?
10. ## [Help] How to create 3d dxtext and rectangle?

I want create a dxdraw rectangle and text on the map. But how to make this possible?
11. ## Check if something is within four given points

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!
12. ## [HELP] How to make this script?

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
13. ## AttachElements seems to break the position of the component

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?
14. ## Calculating position from rotation and offset

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
15. ## [HELP] How to make setElementPosition only for local player?

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.
16. ## [HELP] Why not change marker position?

This is the code: When i type twice " /asd " the marker position does not change.. How to fix this?
17. ## [HELP] How to create marker with random position from table?

I want create a script, which create a marker with random position, from a table. How to make this?
18. ## Additional object editor implementation

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.
19. ## HELP! My bot is not spawning! (slothbot)

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
20. ## [HELP]Vehicle Move

How can I move a vehicle up to a certain point by having it follow the mta streets?
21. ## VehicleExhaustPosition

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.
22. ## Why not working setElementPosition?

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?
23. ## Vehicle cap position

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?
24. ## help [HELP] Change default HUD position.

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?
25. ## set player position inside a vehicle

Is it possible to set the players position inside a vehicle? I tried it bit nothing happened
×

• #### Social Media

×
• Create New...