Jump to content

How to connect server and server


Recommended Posts

So, I'm trying to make a ped have sound, the problem is, I created the ped on the server and it is only possible to create sound on the client.

So, how can I apply a 3DSound to my ped?

function CriarPed (source, command, model)
    local sX, sY, sZ = getElementPosition(source)
    ped = createPed(model, sX, sY, sZ)
    if (ped) then
    outputChatBox ("Criaste um ped com o modelo: " .. model .. ".")
    setPedAnimation(ped, "ped", "WOMAN_walknorm")
    addEventHandler("onPedWasted", ped, PedMorreu)
    else
        outputChatBox("Uso: /criarped 0-312.")
    end
end
addCommandHandler("criarped", CriarPed)


function PedMorreu(player)
    outputChatBox("O teu ped morreu.")
end

 

Link to comment

Like this?:

function CriarPed (source, command, model)
    local sX, sY, sZ = getElementPosition(source)
    ped = createPed(model, sX, sY, sZ)
    if ped then
    outputChatBox ("Criaste um ped com o modelo: " .. model .. ".")
    setPedAnimation(ped, "ped", "WOMAN_walknorm")
    addEventHandler("onPedWasted", ped, PedMorreu)
    triggerClientEvent(playSound3D("reeet.mp3", 269.36532592773,-1939.908203125,1.2081558704376, true))
    else
        outputChatBox("Uso: /criarped 0-312.")
    end
end
addCommandHandler("criarped", CriarPed)
addCommandHandler("cp", CriarPed)
addCommandHandler("criarpedestre", CriarPed)

Now it completely stoped working.

It returns this ERROR:

Resource is loaded, but has errors (Couldn't parse meta file for resource 'main' [Line 8: error reading tag.]

 

My meta.xml:

<meta>
    <info author="HugoAlmeida" type="gamemode" name="O meu humilde servidor" description="Prepara-te, Bill Gates! Eu venho aí!" />
    <script src="script.lua" />
    <script src="scriptclient.lua" type="client" />
    <script src="client/gui.lua" type="client" />
    <script src="ficheiro.lua" />
    <file src="reeet.mp3" />
</meta>

 

 

 
Link to comment

because your meta.xml have errors try to remove the type of gamemode !

        <meta>
        <info author="HugoAlmeida" type="gamemode" name="O meu humilde servidor" description="Prepara-te, Bill Gates! Eu venho aí!" />
       <script src="client.lua" type="client" />
        <script src="ficheiro.lua" />
        <file src="reeet.mp3" />
    </meta>

idk why you save this has script.lua change the name for this file make it has clients.lua or servers..lua or something else and define it has server or client using type function

type="client" /> or  "server" />

 <script src="script.lua" />

for example see my meta.xml  which is working well

<meta>
    <info type="map" version="1.0.1" />
    <map src="clup2.map" dimension="0" />
     <file src="music.mp3" />
    <script src="client.lua" type="client" /> 
</meta>

    

Edited by KINGKHAN
Link to comment
6 hours ago, KINGKHAN said:

because your meta.xml have errors try to remove the type of gamemode !

        <meta>
        <info author="HugoAlmeida" type="gamemode" name="O meu humilde servidor" description="Prepara-te, Bill Gates! Eu venho aí!" />
       <script src="client.lua" type="client" />
        <script src="ficheiro.lua" />
        <file src="reeet.mp3" />
    </meta>

idk why you save this has script.lua change the name for this file make it has clients.lua or servers..lua or something else and define it has server or client using type function

type="client" /> or  "server" />


 <script src="script.lua" />

for example see my meta.xml  which is working well


<meta>
    <info type="map" version="1.0.1" />
    <map src="clup2.map" dimension="0" />
     <file src="music.mp3" />
    <script src="client.lua" type="client" /> 
</meta>

    

Thanks. I had already switched this code to another resource, which wasn't also working, but now I've taken a look at the meta of that resource and it was wrong.

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...