Search the Community
Showing results for tags 'sound'.
-
Olá estou criando um servidor, e a um tempo atrás vi um servidor que o dono executava um comando e todos do servidor escutava um som, achei interessante e queria pro meu servidor, queria uma ajuda para poder fazer isso.
-
So i installed MTA and i have no sound. My sound drivers are up to date and i don't understand the problem. I did download another exe to replace my Steams GTA SA exe because MTA doesn't allow a steam version of GTA SA. I did install MTADiag and it gave me this link : https://pastebin.mtasa.com/821493090 PLEASE SOMEONE HELP
-
Boa tarde! Comecei a tentar mexer em scripter a pouco tempo. Modifiquei um código de sistema de som de carro que funciona perfeitamente, porém: Quando desligo o som ele só desliga pra mim. Todas outras pessoas escutam o som. Elas mesmas precisam ir la no carro, entrar e desligar o painel para desligar o som. O volume só aumenta ou diminui para quem está mexendo no painel de som. Se reinicia o servidor todos carros explodidos voltam a tocar a música antes da explosão. Agradeço desde já a ajuda! Já tentei alterar o código todo e nada de conseguir, estou alterando esse código ha 2 dias e não consigo consertar. Aceito até mesmo apoio profissional (eu pago). local positions = {} local radius = 180 local step = (360 / #playlist) local visible = false local width, height = guiGetScreenSize() sW = (width / 2) sH = (height / 2) local function GeneratePositions(posX,posY,radius,width,angleAmount,startAngle,stopAngle,color,postGUI) if (type( posX ) ~= "number") or (type( posY ) ~= "number") then return false end local function clamp( val, lower, upper ) if ( lower > upper ) then lower, upper = upper, lower end return math.max( lower, math.min( upper, val ) ) end radius = type( radius ) == "number" and radius or 50 width = type( width ) == "number" and width or 5 angleAmount = type( angleAmount ) == "number" and angleAmount or 1 startAngle = clamp( type( startAngle ) == "number" and startAngle or 0, 0, 360 ) stopAngle = clamp( type( stopAngle ) == "number" and stopAngle or 360, 0, 360 ) color = color or tocolor( 255, 255, 255, 200 ) postGUI = type( postGUI ) == "boolean" and postGUI or false if ( stopAngle < startAngle ) then local tempAngle = stopAngle stopAngle = startAngle startAngle = tempAngle end local count = 0; for i = startAngle, stopAngle, angleAmount do local startX = math.cos( math.rad( i ) ) * ( radius - width ) local startY = math.sin( math.rad( i ) ) * ( radius - width ) local endX = math.cos( math.rad( i ) ) * ( radius + width ) local endY = math.sin( math.rad( i ) ) * ( radius + width ) count = count + 1 if count >= step then table.insert(positions, { startX + posX, startY + posY } ) count = 0 end end return true end local function isCursorOnElement(posX,posY,width,height) if isCursorShowing() then local mouseX, mouseY = getCursorPosition() local clientW, clientH = guiGetScreenSize() local mouseX, mouseY = mouseX * clientW, mouseY * clientH if (mouseX > posX and mouseX < (posX + width) and mouseY > posY and mouseY < (posY + height)) then return true end end return false end local function draw() if visible then local veh = getPedOccupiedVehicle(localPlayer) if veh then for i, data in ipairs(positions) do local isPosition = isCursorOnElement(data[1] - 30,data[2] - 30,60,60) dxDrawImage(data[1] - 30,data[2] - 30,60,60,playlist[i][1],0,0,0,tocolor(255,255,255,isPosition and 100 or 255),false) end dxDrawImage(0, 0, width, height, "Assets/bg.png", 0, 0, 0, tocolor(255,255,255,120), false) dxDrawImage(positions[3][1] - 30,positions[3][2] - 120,60,60,"Assets/off.png",0,0,0,tocolor(255,255,255,isCursorOnElement(positions[3][1] - 30,positions[3][2] - 120,60,60) and 100 or 255),false) dxDrawText("VOLUME", sW, sH, width / 2, height / 3,tocolor(255,255,255,255),1.15,"bankgothic","center","center",false,false,true,false,false) local meta = "" local sound = getElementData(veh,"music:attach") if (sound) then if isElement(sound) then local id = getElementData(veh,"music:id") or 0 if id then dxDrawText(playlist[id][3],sW,-180,width / 2,height / 2,tocolor(255,255,255,255),1.65,"default-bold","center","center",false,false,true,false,false) end meta = getSoundMetaTags(sound) if meta.stream_title then dxDrawText("On the air: "..meta.stream_title,sW,-130,width / 2,height / 2,tocolor(255,255,255,255),1,"default-bold","center","center",false,false,true,false,false) end end end local k = "" for i = 1, volume do k = k .. "+" end local s = "" local lenght = string.len(k) if lenght < 10 then for i = 1, (10 - lenght) do s = s .. "−" end end k = "#00cc00" .. k s = "#ff0000" .. s dxDrawText("\n\n["..k..""..s.."#ffffff]",sW,sH,width / 2,height / 3,tocolor(255,255,255,255),2,"default","center","center",false,false,true,true,false) dxDrawText("Para mudar o volume use '-' ou '='",sW,sH,width / 2,height / 2,tocolor(255,255,255,255),1,"default","center","center",false,false,true,true,false) else visible = false end end end volume = 2 function VehicleRadio(vehicle) setRadioChannel(0) setPlayerHudComponentVisible("radio",false) if isElement(vehicle) and getElementType(vehicle) == "vehicle" then local music = getElementData(vehicle,"music:attach") if isElement(music) then destroyElement(music) end local x,y,z = getElementPosition(vehicle) local id = getElementData(vehicle,"music:id") or 0 if playlist[id] then local music = playSound3D(playlist[id][2],x,y,z) setSoundMaxDistance(music,25) attachElements(music,vehicle) setElementData(vehicle,"music:attach",music,false) setSoundVolume(music,volume * 1 / 1) end end end addEventHandler("onClientElementDataChange",getRootElement(), function(dataName,oldValue) if getElementType(source) == "vehicle" and dataName == "music:id" then if isElementStreamedIn(source) then VehicleRadio(source) end end end ); addEventHandler("onClientElementStreamIn",getRootElement(), function() if getElementType(source) == "vehicle" then VehicleRadio(source) end end ); addEventHandler( "onClientElementStreamOut",getRootElement(), function() if getElementType(source) == "vehicle" then local music = getElementData(source,"music:attach") if isElement(music) then destroyElement(music) end end end ); addEventHandler("onClientVehicleExplode",getRootElement(), function() local music = getElementData(source,"music:attach") if isElement(music) then destroyElement(music) end end ); addEventHandler("onClientVehicleExplode",getRootElement(), function() local music = getElementData(source,"music:attach") if isElement(music) then destroyElement(music) end end ); addEventHandler("onClientElementDestroy",getRootElement(), function() if getElementType(source) == "vehicle" then local music = getElementData(source,"music:attach") if isElement(music) then destroyElement(music) end end end ); addEventHandler("onClientResourceStart",resourceRoot, function() setRadioChannel(0) addEventHandler("onClientPlayerRadioSwitch",root, function() cancelEvent() end) local vehicles = getElementsByType("vehicle",root,true) for i, vehicle in ipairs(vehicles) do VehicleRadio(vehicle) end GeneratePositions(sW,sH,radius,nil,nil,nil,360) addEventHandler("onClientRender",root,draw) bindKey(key,"both", function() showCursor(visible) local veh = getPedOccupiedVehicle(localPlayer) if veh then visible = not visible showCursor(visible) end end) function changeVolume(key) local veh = getPedOccupiedVehicle(localPlayer) if veh then local music = getElementData(veh,"music:attach") if isElement(music) then volume = getSoundVolume(music) * 2 if key == down then volume = volume - 1 if volume < 0 then volume = 0 end elseif key == up then volume = volume + 1 if volume > 10 then volume = 10 end end setSoundVolume(music,volume * 1 / 2) end end end bindKey(down,"down",changeVolume) bindKey(up,"down",changeVolume) addEventHandler("onClientClick",root, function(button,state) if (button == "left" and state) then local veh = getPedOccupiedVehicle(localPlayer) if isCursorOnElement(positions[3][1] - 30,positions[3][2] - 120,60,60) then local music = getElementData(veh,"music:attach") if isElement(music) then setElementData(vehicle,"music:attach",music,false) destroyElement(music) stopSound (music) end return true end for i, data in ipairs(positions) do local isPosition = isCursorOnElement(data[1] - 30,data[2] - 30,60,60) if isPosition then setElementData(veh,"music:id",i) setElementData(vehicle,"music:attach",music,false) stopSound (music) break end end end end) end)
-
Gostaria de substituir o som de ignição do motor, já fiz um script em que o player consegue ligar de desligar o motor do veículo apertando determinado botão, mas gostaria de colocar um som para que todos aqueles que estiverem perto do carro do player consigam escutar o som da partida. Segue o link de download do som abaixo: https://drive.google.com/open?id=1ylXf3-E-Gw2wxAeIczvBMdLPduDMvh0p Não sei qual código utilizar, se puderem me ajudar agradeço!
-
This is the code: requestBrowserDomains({"www.convertmp3.io"}) local browser = createBrowser( 0, 0, false ) local currentSound = {} function start(_,link) fetch(link) end addCommandHandler("play",start) function fetch(url) if (url) then fetchRemote("http://www.convertmp3.io/fetch/?format=JSON&video="..url, callback) end end function callback(data, error) if (error ~= 0) then return outputChatBox(error) end if (data == "ERROR") then return outputChatBox("data error") end local data = fromJSON("["..data.."]") if (data) then outputChatBox("Title: "..data.title) outputChatBox("Length: "..data.length) outputChatBox("Link: "..data.link) loadBrowserURL( browser, data.link ) end end addEventHandler( "onClientBrowserNavigate", browser, function( link ) if not link:find("www.convertmp3.io") then local vehicle = getPedOccupiedVehicle ( localPlayer ) local x, y, z = getElementPosition(vehicle) currentSound[localPlayer] = playSound3D( link, x, y, z ) attachElements(currentSound[localPlayer],vehicle) setSoundMaxDistance(currentSound[localPlayer],30) setSoundVolume(currentSound[localPlayer],50) end end ) How to synchronise to all players?
-
function asdasdsas() playSound("http://www.convertmp3.io/fetch/?video=https://www.youtube.com/watch?v=iq7q82Cd6RI") end addCommandHandler("test",asdasdsas) what wrong? the API working fine, but the playSound not.. how to fix?
-
function createBackFire(theVeh, scx, scy, scz) local fireChords={} local dist = 0.04 for i = 1, 6 do local x, y, z = getPositionFromElementOffset(theVeh,scx,scy-dist,scz) fireChords[i]= {pX = x, pY = y, pZ = z} dist = dist + 0.2 end local x,y,z = getPositionFromElementOffset(theVeh,scx,scy,scz) local x2,y2,z2 = getPositionFromElementOffset(theVeh,scx,0,scz) local v1, v2, v3 = getVectors(x,y,z, x2,y2,z2) for i, val in ipairs(fireChords) do fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2,v3, true) fxAddGunshot(val.pX,val.pY,val.pZ, v1+1.5,v2,v3, true) fxAddGunshot(val.pX,val.pY,val.pZ, v1-1.5,v2,v3, true) fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2,v3+0.8, true) fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2,v3-0.8, true) fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2+1,v3+0.8, true) fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2+2,v3+0.8, true) fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2+10,v3+0.8, true) fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2-10,v3+0.8, true) fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2-2,v3+0.8, true) fxAddGunshot(val.pX,val.pY,val.pZ, v1,v2-1,v3+0.8, true) end local s = playSound3D("sound/backfire2.wav", x,y,z, false) setSoundMaxDistance( s, 80 ) setSoundVolume(s, 0.5) I want the code to repeat itself randomly
-
What is wrong with this resource: Client: function playSonido() local sound = playSound("chat.mp3",false) setSoundVolume(sound, 0.9) end addEvent("sonido",true) addEventHandler("sonido",getRootElement(),playSonido) Server: function chat (thePlayer) triggerClientEvent("sonido",getRootElement()) end addEventHandler ( "onPlayerChat", getRootElement(), chat ) Meta: <meta> <info description="Chat sound" author="Hyper" version="5.0" type="script" /> <script src="client.lua" type="client" /> <script src="server.lua" type="client" /> <file src="chat.mp3" /> </meta>
-
I attached a song to my car, but when i'll go far away from car, the music starts from the beginning... s: how to fix this?
-
client: function rtwjhrt() if isElement(ss) then stopSound(ss) return end local car = getPedOccupiedVehicle ( localPlayer ) local gettext = guiGetText ( GUIEditor.edit[1] ) local x, y, z = getElementPosition( car ) local ss = playSound3D( 'asd.mp3', x, y, z ) setSoundMaxDistance( ss, 85 ) attachElements(ss,car) end addEvent("asd123asd456",true) addEventHandler("asd123asd456",root,rtwjhrt) server: function trig() triggerClientEvent(root,"asd123asd456",root) end addEvent( "asjdlaj", true ) addEventHandler( "asjdlaj", root, trig ) Why not hear the sound another players?
-
Hello, I would like to know if you can help me ... My MTA is not coming out sound, but the GTA yes, I would like you to help me because I'm with this problem a year ago
-
I want make a script, which plays sound from youtube.. But.. there is no one converter which would work.. How to use a converter as sound player? Anyone can help?? Sorry for my bad english..
-
I want create a sound requester script, but how to convert yt link to mp3 with script? Sorry for my very bad english.
-
This is the code: And i get this warnings: bad argument @ 'stopSound' [expected sound at argument 1, got nil] and bad argument @ 'detachElement' [expected element at argument 1, got nil] .. -.- how to fix this?
-
The essence of the script: The player enters the /say1 command and the sound is played inside the player. But when I enter this command, the sound does not play. There are no warnings and errors in the log. What could be the problem? Script: function say1(source) if (source) and x and y and z then local x,y,z = getElementPosition(source) if x and y and z then sound = playSound3D('say1.mp3',x,y,z) attachElements (sound,source) setSoundMaxDistance(sound,25) end end end addCommandHandler('say1',say1) meta.xml: <meta> <script src="say1.lua" type="server"/> -- tried type="client"- did not help <file src="say1.mp3" type="server"/> -- tried type="client" - did not help </meta> P.S.: Maybe, my english is not very good...
-
Una consulta chicos como hago para que este local sounds sea infinito ya que cuando activo esta script solo se reproduce una vez y luego se corta.. function onResourceStart() local Zx,Zy,Zz = getElementPosition( ped ) --- Puede ser que halla un mal argumento aquí? porque el debugscript 3 me dice que sí!!!... local sound = playSound("sounds/respiracion.ogg", Zx, Zy, Zz, false) setSoundMaxDistance(sound, 20) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onResourceStart)
-
My mta play sounds but, in minutes the sound make a loop and don't stop, i'm restart the mta and in minutes begins again! In my old gta sa i had tha Proxy_sa.exe and don't have a problems, but i don't know to resolve the issue of sound! Thanks!
-
Hola amigos como andan una vez mas pidiendo ayuda pero bueno, quería saber si me pueden ayudar en un script.. lo que quiero hacer es que al matar a un player con headshot salga un playSound y un dxDrawText diciendo "Headshot", solo queria saber si me pueden dar un ejemplo ? desde ya muchas gracias.