Hugo_Almeidowski Posted January 26, 2019 Share Posted January 26, 2019 (edited) So, I've created a system to create peds, and whenever they are created, it creates a 3d sound at the player's location. The problem is that I want that sound element to be attached to the ped, which I can't, because the ped creation system is in the server and the sound is in the client. So, is there anyway to export the ped element to the client so I can attach the 3d sound to him or atleast create it at his location, or to export the sound element to the server? Client function TocarSomPed () if ( isElement ( sound ) ) then destroyElement ( sound ) end local pX, pY, pZ = getElementPosition(ped) local sound = playSound3D("reeet.mp3", pX, pY, pZ, true) end addEvent("onPedCriado", true) addEventHandler("onPedCriado", root, TocarSomPed) Server function CriarPed (thePlayer, command, model, id, dimensao) local sX, sY, sZ = getElementPosition(thePlayer) ped = createPed(tonumber(model), sX, sY, sZ) pedID = setElementID (ped, id) dimensaoP = setElementDimension(ped, dimensao) if pedID and dimensaoP then qDimensao = getElementDimension(ped) nomePed = getElementID (ped) outputChatBox (horaJ.. "Criaste um ped chamado " ..corPed.. nomePed.. corMJ.. " com o modelo " ..corPed.. model.. corMJ.." na dimensão " ..corEspaco.. qDimensao.. corMJ.. ".", thePlayer, isR, isG, isB, true) setPedAnimation(ped, "ped", "WOMAN_walknorm") triggerClientEvent ("onPedCriado", thePlayer) else destroyElement(ped) outputChatBox(horaE.. "Uso: /criarped [" ..corPed.. "0" ..corErro.. "-" ..corPed.. "312" ..corErro.. "] [" ..corPed.. "Nome do Ped" ..corErro.. "] [" ..corEspaco.. "0" ..corErro.. "-" ..corEspaco.. "65535" ..corErro.. "].", source, isR, isG, isB, true) end end addCommandHandler("criarped", CriarPed) addCommandHandler("cp", CriarPed) addCommandHandler("criarped", CriarPed) Edited January 26, 2019 by Hugo_Almeidowski Link to comment
Moderators IIYAMA Posted January 26, 2019 Moderators Share Posted January 26, 2019 (edited) triggerClientEvent ("onPedCriado", thePlayer, ped) function TocarSomPed (ped) Serverside elements are available on clientside. But clientside created elements are not available serverside. Edited January 26, 2019 by IIYAMA 1 Link to comment
Hugo_Almeidowski Posted January 26, 2019 Author Share Posted January 26, 2019 1 hour ago, IIYAMA said: triggerClientEvent ("onPedCriado", thePlayer, ped) function TocarSomPed (ped) Serverside elements are available on clientside. But clientside created elements are not available serverside. Thank you very much. I think I've got it. I'll try it whenever I get home. 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now