Jump to content

Export an element from server to client


Recommended Posts

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 by Hugo_Almeidowski
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...