Jump to content

Cacaroto

Members
  • Posts

    16
  • Joined

  • Last visited

Cacaroto's Achievements

Square

Square (6/54)

0

Reputation

  1. Okay, I fixed my problem with the animation with a very easy way But the way, the problem I have with the sound is when the map is changing, i used onGamemodeMapStart but still doesn't work
  2. I used the borderless window, but is shaking every second uncontrollably, should i turn on another thing?
  3. I use another way which I think is easier to use: local sX, sY = guiGetScreenSize() --IMAGINE THAT WE WILL DRAW A RECTANGLE myXRes = Your width value of your resolution myYRes = Your height value of your resolution function drawMyRectangle() dxDrawRectangle((position/myXRes)*sX, (position/myYRes)*sY, (sizeX/myXRes)*sX, (sizeY/myYRes)*sY, tocolor(20, 190, 50, 200), false) end addEventHandler("onClientRender", root, drawMyRectangle) Hope I help you!
  4. Is there any way to not turn on that mode? I would like to use full screen
  5. It works now, but I don't know how to make the regresive animation only with interpolateBetween, can you help me? By the way, I need help removing the music of maps. I used a loop to mute every sound and turn on the radio one, and the same to mute the radio and turn on the other sounds, but the problem comes when I start a gamemode map and that map has music, I tried using onGamemodeMapStarts which is a function of mapmanager but it doesn't work, if you could help me with that too... function knowRadioSong() start = getTickCount() addEventHandler("onClientRender", root, outputRadioSongName) pos = ((1875-longTitle)/1920)*sX pos2 = (1880/1920)*sX setTimer ( function() pos = (1925/1920)*sX pos2 = (-500/1920)*sX end, 5000, 1) end addCommandHandler("radio", knowRadioSong) function outputRadioSongName() local now = getTickCount() local elapsedTime = now - start local duration = 1000 local progress = elapsedTime / duration local x, y, z = interpolateBetween((1925/1920)*sX, (160/1080)*sY, 0, pos, (160/1080)*sY, 0, progress, "OutBack") local x1, y1, z1 = interpolateBetween(((1920+longTitle)/1920)*sX, (175/1080)*sY, 0, pos2, (175/1080)*sY, 0, progress, "OutBack") dxDrawRoundedRectangle(x, y, ((15+longTitle)/1920)*sX, (30/1080)*sY, tocolor(255, 255, 255, 200), tocolor(255, 255, 255, 200), false) dxDrawText(title, x1, y1, x1, y1, tocolor(0, 0, 0, 255), (1/1920)*sX, "default-bold", "right", "center", false, false, false, false, false) end function openRadio() if open == false then open = true addEventHandler("onClientRender", root, drawRadio) for v, k in ipairs(getElementsByType("sound")) do setSoundVolume(k, 0) end setSoundVolume(radio, 1) else open = false removeEventHandler("onClientRender", root, drawRadio) removeEventHandler("onClientRender", root, outputRadioSongName) for v, k in ipairs(getElementsByType("sound")) do setSoundVolume(k, 1) end setSoundVolume(radio, 0) end end bindKey("n", "down", openRadio)
  6. I was scripting a radio system but there's no way to let me move the text, the animation of the rectangle is done but it doesn't make any effect with the text. Also I was trying to show all this for a period of 5 seconds, but when I added the timer, the rectangle and the text only appear but not dissapear, can someone help me? local sX, sY = guiGetScreenSize() local open = false local radio = playSound("http://www.energy981.com/playlist/Energy98_128WM.asx") setSoundVolume(radio, 0) function drawRadio() ls,rs = getSoundLevelData(radio) meta = getSoundMetaTags(radio); title = meta.stream_title or "Unknown" longTitle = dxGetTextWidth(title, (1/1920)*sX, "default-bold", false) dxDrawCircle ((1880/1920)*sX, (125/1080)*sY, 20, 0, 360, tocolor(9, 27, 79, 200), tocolor(9, 27, 79, 200), 32, 1, false) dxDrawCircle ((1880/1920)*sX, (125/1080)*sY, 100*((ls+rs)/230768), 0, 360, tocolor(0, 225, 255, 50), tocolor(0, 225, 255, 25), 32, 1, false) dxDrawImage((1868/1920)*sX, (113/1080)*sY, (24/1920)*sX, (23/1080)*sY, "radio.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end function knowRadioSong() start = getTickCount() addEventHandler("onClientRender", root, outputRadioSongName) end addCommandHandler("radio", knowRadioSong) function outputRadioSongName() pos = ((1875-longTitle)/1920)*sX setTimer ( function() pos = (1925/1920)*sX end, 5000, 1) local now = getTickCount() local elapsedTime = now - start local endTime = start + 1000 local duration = endTime - start local progress = elapsedTime / duration local x, y, z = interpolateBetween(pos, (160/1080)*sY, 0, pos, (160/1080)*sY, 0, progress, "OutBack") local x1, y1, z1 = interpolateBetween((0/1920)*sX, (-365/1080)*sY, 0, (-35/1920)*sX, (-365/1080)*sY, 0, progress, "OutBack") dxDrawRoundedRectangle(x, y, ((15+longTitle)/1920)*sX, (30/1080)*sY, tocolor(255, 255, 255, 200), tocolor(255, 255, 255, 200), false) dxDrawText(title, (1848/1920)*sX, (159/1080)*sY, (1883/1920)*sX, (190/1080)*sY, tocolor(0, 0, 0, 255), (1/1920)*sX, "default-bold", "right", "center", false, false, false, false, false) end function openRadio() if open == false then open = true addEventHandler("onClientRender", root, drawRadio) setSoundVolume(radio, 1) else open = false removeEventHandler("onClientRender", root, drawRadio) removeEventHandler("onClientRender", root, outputRadioSongName) setSoundVolume(radio, 0) end end bindKey("m", "down", openRadio)
  7. So, I'm scripting and you know, I have to be between desktop and MTA a lot, but there's something that make me mad and is that my MTA takes a lot to open, well, not that much, but maybe 3 seconds or so... Any help for how to solve this?
  8. Okay, I fixed it, thanks man!
  9. Thanks so much! It works really fine! But there's a problem with nos, when a player pickups the nos the bar doesnt appear until he uses it, i don't know how to fix it
  10. Doesn't work, I still have the same output in the debug https://gyazo.com/478e7d84d0468b00246b8b3b76b8c7fe
  11. So I was scripting a HUD and almost everything is fine (everything okay for local player), but when a player die I want to show up in the HUD the car stats of the vehicle im spectating but it doesn't work, here i post the code: function drawSpeedo() if isPedInVehicle(getLocalPlayer()) or isPedInVehicle(getVehicleOccupant(getCameraTarget(localPlayer))) then if isPedDead(localPlayer) then specHealth = getElementHealth(getCameraTarget(localPlayer)) sHealth = (math.max(specHealth - 250, 0)/750)*100 colorR = sHealth > 50 and (255/100)*(100 - sHealth*2) + 255 or 255 colorG = sHealth > 50 and 255 or (255/100)*(sHealth*2) sx, sy, sz = getElementVelocity (getCameraTarget(localPlayer)) spectSpeed = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) dxDrawText(spectSpeed.." km/h", (1680/1920)*sX, (940/1080)*sY, (1804/1920)*sX, (966/1080)*sY, tocolor(255, 255, 255, 255), (1/1920)*sX, font, "center", "top", false, false, false, false, false) dxDrawRectangle((1620/1920)*sX, (990/1080)*sY, (((specHealth/10)*2.5)/1920)*sX, (7/1080)*sY, tocolor(colorR, colorG, 0, 255), false) dxDrawCircle (((1620+(specHealth/10)*2.5)/1920)*sX, (993/1080)*sY, 7, 0, 360, tocolor(colorR, colorG, 0, 255), tocolor(colorR, colorG, 0, 255), 32, 1, false) nitro = getVehicleUpgradeOnSlot(getCameraTarget(localPlayer), 8 ) nosLevel = getVehicleNitroLevel(getCameraTarget(localPlayer))*100 or 0 nosColor = isVehicleNitroActivated(getCameraTarget(localPlayer)) and colorTable[ "using" ] or isVehicleNitroRecharging(getCameraTarget(localPlayer)) and colorTable[ "chargin" ] or colorTable[ "stock" ] dxDrawRectangle((1620/1920)*sX, (1020/1080)*sY, (((nosLevel*250)/100)/1920)*sX, (7/1080)*sY, nosColor, false) dxDrawCircle (((1620+(nosLevel*2.5))/1920)*sX, (1023/1080)*sY, 7, 0, 360, nosColor, nosColor, 32, 1, false) else vehHealth = getElementHealth(getPedOccupiedVehicle(localPlayer)) health = (math.max(vehHealth - 250, 0)/750)*100 colorR = health > 50 and (255/100)*(100 - health*2) + 255 or 255 colorG = health > 50 and 255 or (255/100)*(health*2) sx, sy, sz = getElementVelocity (getPedOccupiedVehicle(getLocalPlayer())) vehSpeed = math.floor(((sx^2 + sy^2 + sz^2)^(0.5))*180) dxDrawText(vehSpeed.." km/h", (1680/1920)*sX, (940/1080)*sY, (1804/1920)*sX, (966/1080)*sY, tocolor(255, 255, 255, 255), (1/1920)*sX, font, "center", "top", false, false, false, false, false) dxDrawRectangle((1620/1920)*sX, (990/1080)*sY, (((vehHealth/10)*2.5)/1920)*sX, (7/1080)*sY, tocolor(colorR, colorG, 0, 255), false) dxDrawCircle (((1620+(vehHealth/10)*2.5)/1920)*sX, (993/1080)*sY, 7, 0, 360, tocolor(colorR, colorG, 0, 255), tocolor(colorR, colorG, 0, 255), 32, 1, false) nitro = getVehicleUpgradeOnSlot(getPedOccupiedVehicle(localPlayer), 8 ) nosLevel = getVehicleNitroLevel(getPedOccupiedVehicle(localPlayer))*100 or 0 nosColor = isVehicleNitroActivated(getPedOccupiedVehicle(localPlayer)) and colorTable[ "using" ] or isVehicleNitroRecharging( getPedOccupiedVehicle(getLocalPlayer()) ) and colorTable[ "chargin" ] or colorTable[ "stock" ] dxDrawRectangle((1620/1920)*sX, (1020/1080)*sY, (((nosLevel*250)/100)/1920)*sX, (7/1080)*sY, nosColor, false) dxDrawCircle (((1620+(nosLevel*2.5))/1920)*sX, (1023/1080)*sY, 7, 0, 360, nosColor, nosColor, 32, 1, false) end end end addEventHandler("onClientRender", root, drawSpeedo)
  12. Okay, so would be done just checking if a player passes from -3000 or +3000 with getElementPosition? CLIENT function checkIfPlayerPassedLimit() local x, y, z = getElementPosition(getLocalPlayer()) if x > 3000 or -3000 or y > 3000 or -3000 or z > 3000 or -3000 then local pName = getPlayerName(getLocalPlayer()) triggerServerEvent ( "onLimitPass", resourceRoot, pName) end end SERVER function greetingHandler (pName) outputChatBox( pName.." has passed map limit.", getRootElement(), 255, 255, 255, trues ) end addEvent( "onLimitPass", true ) addEventHandler( "onLimitPass", resourceRoot, greetingHandler )
  13. I was trying to create a script which detect if a player has passed the map limit (in general case GTA:SA map). I tried something with getElementPosition but I think it's a bad way to develop this resource. Can somebody help me?
×
×
  • Create New...