Jump to content

Matevsz

Members
  • Posts

    193
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Matevsz

  1. 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
  2. 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)
  3. 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
  4. 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)
  5. 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
  6. 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
  7. Oczywiście, oto one: https://krakenfiles.com/view/DJE5sbnmjT/file.html
  8. 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
  9. 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
  10. 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
  11. Hi, I'm trying to make a speedometer created in GUIEditor, but I can't make the needle move. I saw that many speedometers are made with dxDrawRelativeImage and how to do it with GUIEditor? GUIEditor.staticimage[8] = guiCreateStaticImage(1159 * scaleX, 741 * scaleY, 257 * scaleX, 244 * scaleY, "Speedo/ASDDIAL.png", false) GUIEditor.staticimage[9] = guiCreateStaticImage(21 * scaleX, 10 * scaleY, 216 * scaleX, 246 * scaleY, "Speedo/DALTLONG.png", false, GUIEditor.staticimage[8]) local function drawSpeedo() local veh = getPedOccupiedVehicle(localPlayer) if not veh then return end local velx, vely, velz = getElementVelocity(veh) local speed = (velx ^ 2 + vely ^ 2 + velz ^ 2) ^ (0.5) needleRotation = -146 + (speed * 180) end local isSpeedoShown = false function toggleRender(bool) if bool then isSpeedoShown = true addEventHandler("onClientRender", root, drawSpeedo) addEventHandler("onClientRender", root, rotateNeedle) else isSpeedoShown = false removeEventHandler("onClientRender", root, drawSpeedo) removeEventHandler("onClientRender", root, rotateNeedle) end end function rotateNeedle() local needleImage = GUIEditor.staticimage[9] guiSetProperty(needleImage, "Rotated", tostring(needleRotation)) end
  12. Hi all, I'm trying to make these clocks appear after entering models with appropriate IDs, but they show up after entering each vehicle model local modelsID = {511, 593, 512, 460, 513, 548, 425, 417, 487, 488, 497, 563, 447, 469} GUIEditor = { staticimage = {} } addEventHandler("onClientPlayerVehicleEnter", localPlayer, function(modelsID) GUIEditor.staticimage[1] = guiCreateStaticImage(373, 741, 257, 244, "clocks/Turn_indicator.png", false) GUIEditor.staticimage[2] = guiCreateStaticImage(56, 96, 142, 34, "clocks/airplane.png", false, GUIEditor.staticimage[1]) GUIEditor.staticimage[3] = guiCreateStaticImage(118, 149, 17, 17, "clocks/icon.png", false, GUIEditor.staticimage[1]) GUIEditor.staticimage[4] = guiCreateStaticImage(634, 741, 255, 244, "clocks/ALDDIAL.png", false) GUIEditor.staticimage[5] = guiCreateStaticImage(-4, 10, 266, 211, "clocks/DALTLONG.png", false, GUIEditor.staticimage[4]) GUIEditor.staticimage[6] = guiCreateStaticImage(32, 11, 193, 200, "clocks/DALTSHORT.png", false, GUIEditor.staticimage[4]) GUIEditor.staticimage[7] = guiCreateStaticImage(893, 741, 262, 244, "clocks/StucznyHoryzont.png", false) GUIEditor.staticimage[8] = guiCreateStaticImage(1159, 741, 257, 244, "clocks/ASDDIAL.png", false) GUIEditor.staticimage[9] = guiCreateStaticImage(21, 10, 216, 246, "clocks/DALTLONG.png", false, GUIEditor.staticimage[8]) GUIEditor.staticimage[10] = guiCreateStaticImage(1416, 741, 254, 244, "clocks/licznikStopni.png", false) GUIEditor.staticimage[11] = guiCreateStaticImage(79, 51, 98, 139, "clocks/samolotDoLicznikaStopni.png", false, GUIEditor.staticimage[10]) end )
  13. Hello, how do you make random objects appear and blips on them? Objects: createObject(1264, -2168.7001953125, 1879.7998046875, -69.199996948242, 3, 1644) createObject(926, -2198.599609375, 1853.400390625, -57.599998474121, 0, 353.99597167969, 0, 3, 2033) createObject(1356, -2156.6796875, 1838.1103515625, -65.067947387695, 3, 2037) createObject(1442, -2159.599609375, 1827.900390625, -64.300003051758, 3, 2060) createObject(924, -2134.8994140625, 1838.2001953125, -63.599998474121, 349.99694824219, 0, 1.99951171875, 3, 2033) createObject(928, -2085.5, 1847.7998046875, -54.099998474121, 3, 1644) createObject(1230, -2154.7998046875, 1844.099609375, -49.099998474121, 3, 2033) createObject(916, -2131.7998046875, 1847.599609375, -51.5, 3, 2037) createObject(917, -2110.2998046875, 1847.7001953125, -42.299999237061, 3, 1644) createObject(1265, -2104.099609375, 1852.099609375, -36.700000762939, 350.01892089844, 355.93505859375, 1.2908935546875, 3, 2060) createObject(1371, -2123.099609375, 1842, -54.799999237061, 2037, 3, 2060) createObject(1357, -2146.5, 1851.7001953125, -60.200000762939, 0, 353.99597167969, 0, 3, 1644) createObject(926, -2156, 1860.7001953125, -61.400001525879, 3, 2033) so the id of the object is local objects = { {1264}, {926}, {1356}, {1442}, {924}, {928}, {1230}, {916}, {917}, {1265}, {1371}, {1357} } And now how do you make the objects appear randomly? And the blips on them? I tried: createBlipAttachedTo(objects, 0) Error:Bad argument "Expected element at argument 1, got table"
  14. and can not by setPedControlState? And the warpPedIntoVehicle how to pass the car? but not created createVehicle only for example summoned
  15. I have done the summon command: function Ped(thePlayer) x, y, z = getElementPosition(thePlayer) createPed(299, x+0.5, y, z) end addCommandHandler("summon", Ped) addEventHandler("onClientVehicleEnter", root, function(player,seat,door) x, y, z = getElementPosition(player) ped = createPed(299, x+0.5, y, z) if (seat==0) and (door==0) then setPedControlState(ped, "enter_exit", true) end end ) just how to do that as we get into the car it also gets ped?
  16. how to do that when you type the command /summon ped walked behind us?
  17. Witam, zrobiłem kod, gdzie po wjechaniu samochodem do markeru pokazuje się gui, GridList, w kolumnie1 "Model" -> row "-" ma się pokazać nazwa samochodu. Pobiera jednak nazwę mojego samochodu a nie kogoś, kto wjedzie w marker. Pomoże ktoś? silnikIOpony = createMarker(-2050.5, 167.39999, 27.9, "cylinder", 1, 255, 0, 0, 0) -- marker do otwarcia GUI InfoOSamochodzie = createMarker(-2052.3999023438, 170.5, 27.799999237061, "cylinder", 4, 255, 255, 255, 255) -- marker w którym stoi samochód local screenW, screenH = guiGetScreenSize() komputerOponySilniki = guiCreateWindow(10, (screenH - 372) / 2, 836, 372, "Diagnostyka Komputerowa", false) guiWindowSetSizable(komputerOponySilniki, false) guiSetVisible(komputerOponySilniki, false) panelUszkodzen = guiCreateGridList(10, 29, 669, 287, false, komputerOponySilniki) column1 = guiGridListAddColumn(panelUszkodzen, "Model", 0.3) row = guiGridListAddRow(panelUszkodzen) nazwa = guiGridListSetItemText(panelUszkodzen, 0, 1, "-", false, false) addEventHandler("onClientMarkerHit", InfoOSamochodzie, function(hitPlayer,matchingDimension) if (not matchingDimension) or (isElement(komputerOponySilniki)) or (hitPlayer ~= localPlayer) then return end local veh = getPedOccupiedVehicle(localPlayer) guiGridListSetItemText(panelUszkodzen, 0, 1, ""..getVehicleName(veh).."", false, false) end ) addEventHandler("onClientMarkerLeave", InfoOSamochodzie, function(leftPlayer,matchingDimension) if (leftPlayer == localPlayer) and (matchingDimension) and (isElement(komputerOponySilniki)) then guiGridListClear(column1) end end )
  18. Witam, zrobiłem kod, gdzie po wjechaniu samochodem do markeru pokazuje się gui, GridList, w kolumnie1 "Model" -> row "-" ma się pokazać nazwa samochodu. Pobiera jednak nazwę mojego samochodu a nie kogoś, kto wjedzie w marker. Pomoże ktoś? silnikIOpony = createMarker(-2050.5, 167.39999, 27.9, "cylinder", 1, 255, 0, 0, 0) -- marker do otwarcia GUI InfoOSamochodzie = createMarker(-2052.3999023438, 170.5, 27.799999237061, "cylinder", 4, 255, 255, 255, 255) -- marker w którym stoi samochód local screenW, screenH = guiGetScreenSize() komputerOponySilniki = guiCreateWindow(10, (screenH - 372) / 2, 836, 372, "Diagnostyka Komputerowa", false) guiWindowSetSizable(komputerOponySilniki, false) guiSetVisible(komputerOponySilniki, false) panelUszkodzen = guiCreateGridList(10, 29, 669, 287, false, komputerOponySilniki) column1 = guiGridListAddColumn(panelUszkodzen, "Model", 0.3) row = guiGridListAddRow(panelUszkodzen) nazwa = guiGridListSetItemText(panelUszkodzen, 0, 1, "-", false, false) addEventHandler("onClientMarkerHit", InfoOSamochodzie, function(hitPlayer,matchingDimension) if (not matchingDimension) or (isElement(komputerOponySilniki)) or (hitPlayer ~= localPlayer) then return end local veh = getPedOccupiedVehicle(localPlayer) guiGridListSetItemText(panelUszkodzen, 0, 1, ""..getVehicleName(veh).."", false, false) end ) addEventHandler("onClientMarkerLeave", InfoOSamochodzie, function(leftPlayer,matchingDimension) if (leftPlayer == localPlayer) and (matchingDimension) and (isElement(komputerOponySilniki)) then guiGridListClear(column1) end end )
  19. And somebody will help to change so that it picks the car up from the marker and not my? By getElementsWithinMarker
  20. How to do that when you drive a car in the marker appeared in the name of the car gridlist column? InfoCar = createMarker(-2052.3999023438, 170.5, 27.799999237061, "cylinder", 4, 255, 0, 0, 0) carsPanel = guiCreateWindow(10, (screenH - 372) / 2, 836, 372, "Car", false) gridList = guiCreateGridList(10, 29, 669, 287, false, carsPanel) column1 = guiGridListAddColumn(gridList, "Model", 0.3) row = guiGridListAddRow(gridList) nameCar = guiGridListSetItemText(gridList, 0, 1, "-", false, false)
  21. Okay. Thanks. You could still help me with the object / Scroll Bar / and lifting? guiScrollBarSetScrollPosition(scroll, 0) Scroll is set to 0. X, Y, Z, X1, Y2, Z2, Object: min. = -2052.5, 170.3, 27.5, 0, 0, 90 max. = -2052.5, 170.3, 27.1, 0, 0, 90 Now how to lift up an object using scrollBar?
  22. Because, I don't like markers. Can you give me an example of how to use colshapes?
×
×
  • Create New...