Matevsz
Members-
Posts
197 -
Joined
-
Last visited
-
Days Won
1
Matevsz last won the day on April 13 2024
Matevsz had the most liked content!
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Matevsz's Achievements
Mark (16/54)
1
Reputation
-
Matevsz started following the degree of tilt of the aircraft to the side , Marker near plane , Airplane lights and 3 others
-
Hi, how do I make a marker appear next to the plane after pressing the "3" key? for plane (553) local x, y, z = getElementPosition(player) local lightMarker = createMarker(x, y, z - 1, "corona", 1, 255, 255, 255, 150) attachElements(lightMarker, vehicle, 4, 3, -2) setElementData(vehicle, "Marker", lightMarker) local x, y, z = getElementPosition(player) local lightMarker2 = createMarker(x, y, z - 1, "corona", 1, 255, 255, 255, 150) attachElements(lightMarker2, vehicle, -4, 3, -2) setElementData(vehicle, "Marker2", lightMarker2)
-
Hello, is there any way to place a light like that of a motorbike under the plane to get this effect? https://tinypic.host/image/Airplane-lights.DUK2Au - image
-
Hi, I would like the tram to stop at the given coordinates for 5 seconds and then continue to the next ones, it works at the first stop, but then it stops after the coordinates tram = createVehicle(x,y,z) local stops ={ {x = -2265.1001, y = 701.59998, z = 48.3}, {x = -2264.8, y = 1030.9, z = 82.7}, {x = -1986.2, y = 1287.3, z = 6}, {x = -1668.9, y = 1252.6, z = 6}, {x = -1581.3, y = 981.09998, z = 6}, {x = -1779.6, y = 929.09998, z = 23.7}, {x = -2006.3, y = 882, z = 44.3}, {x = -1601.1, y = 840.59998, z = 6.5}, {x = -1681.8, y = 734.09998, z = 20.4}, {x = -1869.3, y = 608.40002, z = 34.1}, {x = -2006.6, y = 154.2, z = 26.5}, {x = -2234.7, y = -70.1, z = 34.2} } local currentStop = 0 local nextStop = 1 local isStopped = false function moveTramToNextStop() if not isElement(tram) then return end local currentX, currentY, currentZ = getElementPosition(tram) local nextX, nextY, nextZ = stops[nextStop].x, stops[nextStop].y, stops[nextStop].z local distance = getDistanceBetweenPoints3D(currentX, currentY, currentZ, nextX, nextY, nextZ) local speed = 0.2 if distance < speed then if not isStopped then isStopped = true setTimer(function() isStopped = false currentStop = nextStop nextStop = (nextStop % #stops) + 1 end, 5000, 1) end else isStopped = false local ratio = speed / distance local newX = currentX + (nextX - currentX) * ratio local newY = currentY + (nextY - currentY) * ratio local newZ = currentZ + (nextZ - currentZ) * ratio setElementPosition(tram, newX, newY, newZ) end end setTimer(moveTramToNextStop, 50, 0)
-
I used the above examples and now in the code: hud = {} moneyHUD = {"money"} hud.font = dxCreateFont("font.ttf", 32.5, false, "antialiased") local moneyMin = 0 local moneyMax = 99999999 local currentMoney = getPlayerMoney(localPlayer) addEventHandler("onClientResourceStart", resourceRoot, function() setPlayerHudComponentVisible(moneyHUD[1], false) end) function lerp(a, b, t) return a + (b - a) * t end addEventHandler("onClientRender", root, function() local money = getPlayerMoney(localPlayer) money = math.max(moneyMin, math.min(moneyMax, money)) currentMoney = lerp(currentMoney, money, 0.05) -- dxDrawText line end) after adding money, e.g. 25555, the player gets 25554 instead of 25555
-
When I did not use the interpolateBetween function, after adding an amount larger than the maximum, e.g. 111111111, the amount appeared 99999999 and with the interpolateBetween function the animation ends at 100000000
-
No problem, nothing happened. Now it adds and subtracts money smoothly, but after exceeding the maximum amount (99999999) the amount is 100000000. I added it to the code (math.min)
-
hud={} moneyHUD={"money"} hud.font = dxCreateFont("font.ttf", 32.5, false, "antialiased") local lastMoney = 0 local moneyChangeStartTime = 0 local moneyChangeDuration = 2000 addEventHandler("onClientResourceStart", getResourceRootElement, function() setPlayerHudComponentVisible(moneyHUD, false) end) addEventHandler("onClientRender", root, function() local money = getPlayerMoney(localPlayer) money = math.min(money, 99999999) if money ~= lastMoney then lastMoney = money moneyChangeStartTime = getTickCount() end local elapsedTime = getTickCount() - moneyChangeStartTime local progress = elapsedTime / moneyChangeDuration local money = interpolateBetween(0, 0, 0, money, 0, 0, progress, "Linear") dxDrawText("$00000000", 1305, 278, 1598, 328, tocolor(255, 255, 255, 255), 1.00, hud.font, "center", "center", false, false, false, false, false) if elapsedTime >= moneyChangeDuration then lastMoney = money end end) adds money smoothly, but when you add an amount greater than the maximum (99999999) it starts adding again from zero
-
Hello everyone. How can I make it add smoothly when adding an amount, e.g. $10? $1, $2, $3, $4... and not $10 right away? hud = {} moneyHUD = {"money"} hud.font = dxCreateFont("font.ttf", 32.5, false, "antialiased") addEventHandler("onClientResourceStart", getResourceRootElement, function() setPlayerHudComponentVisible(moneyHUD, false) end) addEventHandler("onClientRender", root, funtion() local money = getPlayerMoney(localPlayer) dxDrawText("$000000000", 1305, 278, 1598, 328, tocolor(255, 255, 255, 255), 1.00, hud.font, "center", "center", false, false, false, false, false) end)
-
Witam, czego użyć lub w jaki sposób stworzyć system paliwa dla samolotów? local screenX, screenY = guiGetScreenSize() local scale = math.min(screenX/1680, screenY/1050) local function dxDrawRelativeImage(x, y, w, h, image, r, g, b, a, postGUI) return dxDrawImage(x * scale, y * scale, w * scale, h * scale, image, r, g, b, a, postGUI) end local samolotyZJednymSilnikiem = { [593] = true, [512] = true, [476] = true, [460] = true, [513] = true, [548] = true, [425] = true, [417] = true, [487] = true, [488] = true, [497] = true, [563] = true, [447] = true, [469] = true } function Zegary() dxDrawRelativeImage(899, 741, 249, 244, "Zegary/paliwo_jednosilnikowe.png") -- zegar paliwa dxDrawRelativeImage(899 + 15, 741 + 25, 176, 195, "Zegary/DALTSHORT.png", 128) -- wskazówka paliwa ustawiona na rezerwę end local pokazZegary = false function toggleRender(bool) if bool then pokazZegary = true addEventHandler("onClientRender", root, Zegary) else pokazZegary = false removeEventHandler("onClientRender", root, Zegary) end end local fuelMarkerSF = createMarker(-1118.2998046875, -191.599609375, 13.5, "cylinder", 30) local oknoDystrybutora = guiCreateStaticImage(930, 434, 314, 229, "Zegary/paliwoSamolotowe.png", false) -- okno tankowania guiSetVisible(oknoDystrybutora, false) local tankuj = guiCreateButton(147, 151, 128, 39, "Tankuj", false, oknoDystrybutora) -- button tankowania guiSetVisible(tankuj, false) local zamknij = guiCreateButton(46, 35, 23, 22, "X", false, oknoDystrybutora) -- zamknięcie okna guiSetVisible(zamknij, false) function onFuelMarkerHit(hitElement) local veh = getPedOccupiedVehicle(localPlayer) if not veh or not samolotyZJednymSilnikiem[getElementModel(veh)] then return end local vx, vy, vz = getElementVelocity(veh) local speed = math.sqrt(vx^2 + vy^2 + vz^2) if speed < 1 then guiSetVisible(oknoDystrybutora, true) guiSetVisible(tankuj, true) guiSetVisible(zamknij, true) showCursor(true) end end addEventHandler("onClientMarkerHit", fuelMarkerSF, onFuelMarkerHit) function zamknijPanelPaliwa() guiSetVisible(oknoDystrybutora, false) guiSetVisible(tankuj, false) guiSetVisible(zamknij, false) showCursor(false) end addEventHandler("onClientGUIClick", zamknij, zamknijPanelPaliwa) local litryPaliwa = 26 local cenaZaLitr = 3.50 Jak zrobić aby domyślnie gdy pojazd nie był tankowany po wejściu będzie miał rezerwę? Rotacje wskazówki wynoszą full: dxDrawRelativeImage(899 + 20, 741 + 25, 176, 195, "Zegary/DALTSHORT.png", 30) rezerwa: dxDrawRelativeImage(899 + 20, 741 + 25, 176, 195, "Zegary/DALTSHORT.png", 128) pusty: dxDrawRelativeImage(899 + 20, 741 + 25, 176, 195, "Zegary/DALTSHORT.png", 150) Tak to wygląda: https://tinypic.host/image/paliwo.Dv9rAd
-
Ustawiłem w grze, dziękuje bardzo, mam jeszcze pytanie co do obrazu samolotu, jak mogę go przechylić w rotacji? aktualne współrzędne są podane by obraz samolotu był prosto a chciałbym żeby przechylał się tak jak porusza się kulka tylko po ukosie. Gdy kulka jest na max w lewo samolot byłby przechylony do drugiej kreski w lewo i tak samo w prawo
-
Co masz na myśli szerokość paska? Próbowałem w ten sposób ale kulka przesuwa się poza obręb zegara local samolotyZStalymPodwoziem = { [417] = true, [425] = true, [447] = true, [460] = true, [469] = true, [487] = true, [488] = true, [497] = true, [511] = true, [512] = true, [513] = true, [548] = true, [563] = true, [593] = true } local rollDegrees = 0 function Zegary() ----przechył samolotu w lewo i prawo local vehicle = getPedOccupiedVehicle(localPlayer) if not vehicle or not samolotyZStalymPodwoziem[getElementModel(vehicle)] then return end local _, _, rotation = getElementRotation(vehicle) rollDegrees = rotation local centerX = 373 + 118 --środek kulki X local centerY = 741 + 149 --środek kulki Y local maxOffsetLeftX = 373 + 72 -- maksymalna pozycja kulki po lewej względem 90 stopni (373 + 72, 741 + 144, 17, 17) local maxOffsetRightX = 741 + 164 -- maksymalna pozycja kulki po prawej względem 90 stopni (373 + 164, 741 + 144, 17, 17) local xOffset = 0 if rollDegrees >= -90 and rollDegrees <= 0 then xOffset = -maxOffsetLeftX * (rollDegrees / -90) elseif rollDegrees > 0 and rollDegrees <= 90 then xOffset = maxOffsetRightX * (rollDegrees / 90) end local newX = centerX + xOffset local newY = 741 + 144 outputDebugString("Aktualny stopien przechyłu samolotu: " .. tostring(rollDegrees)) dxDrawRelativeImage(373, 741, 257, 244, "Zegary/Turn_indicator.png") dxDrawRelativeImage(373 + 56, 741 + 96, 142, 34, "Zegary/samolot.png") dxDrawRelativeImage(newX, newY, 17, 17, "Zegary/kulka.png") --domyślnie dxDrawRelativeImage(373 + 118, 741 + 149, 17, 17, "Zegary/kulka.png") end local pokazZegary = false function toggleRender(bool) if bool then pokazZegary = true addEventHandler("onClientRender", root, Zegary) else pokazZegary = false removeEventHandler("onClientRender", root, Zegary) end end
-
Sorry, my browser automatically translated the text before submitting the topic. I would like the given ball visible in the first photo (in the middle) to move left or right depending on the current degree of the plane's sideways tilt. If the plane banked 90 or 180 degrees to the left? (as in the second photo), then the ball should move to the left to the given coordinates 373 + 72, 741 + 144, 17, 17 If the plane tilts 90/180 degrees to the right, the ball should move to the right to the coordinates 373 + 164, 741 + 144, 17, 17 I'm sending a photo of what it should look like https://tinypic.host/image/3.DhZu6f
-
Witam, mam problem z przesunięciem zdjęcia kuli w prawo lub w lewo w zależności od aktualnego przechyłu samolotu na bok. położenie piłki w środku dxDrawRelativeImage(373 + 118, 741 + 149, 17, 17, "Zegary/kulka.png") https://ibb.co/QvbvP1g (png) A chciałbym tak po przechyleniu samolotu na bok (jak na zdjęciu) https://ibb.co/ZLncxgF (png) pozycja piłki po lewej stronie byłaby 373 + 72, 741 + 144, 17, 17 i w prawo 373 + 164, 741 + 144, 17, 17