Jump to content

Sound doesn't play


BriGhtx3

Recommended Posts

Posted

This is my Client File :

  
function nHalt() 
local sound = playSound("sounds/Bus/nHalt.ogg") 
end 
  
function lt() 
nHalt() 
local ltr = playSound("sounds/Bus/Bushaltestellen/LTR.ogg") 
end 
addEvent("LTR", true) 
addEventHandler("LTR", getRootElement(), lt) 
  
function SchrottP() 
nHalt() 
local schrott = playSound("sounds/Bus/Bushaltestellen/Schrott.ogg") 
end 
addEvent("Schrott", true) 
addEventHandler("Schrott", getRootElement(), SchrottP) 
  
function AngelP() 
nHalt() 
local angel = playSound("sounds/Bus/Bushaltestellen/Angel.ogg") 
end 
addEvent("Angel", true) 
addEventHandler("Angel", getRootElement(), AngelP) 
  

My Server File :

local HalteNr1 
function startJob(thePlayer) 
HalteNr1 = createMarker ( -2435, -595, 132, "checkpoint", 10, 125, 0, 0, 255, thePlayer ) 
HalteNr1B = createBlip ( -2435, -595, 132, 0, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) 
triggerClientEvent ( thePlayer, "LTR", getRootElement() ) 
triggerClientEvent ( thePlayer, "infobox_start", getRootElement(), "\nDienst gestartet!", 5000, 125, 0, 0 ) 
addEventHandler("onMarkerHit", HalteNr1, cMarker) 
end 
  
local HalteNr2 
function cMarker(thePlayer) 
    local money = vioGetElementData(thePlayer, "money") 
    vioSetElementData ( thePlayer, "money", tonumber(money)+50 ) 
    givePlayerMoney(thePlayer, 50) 
  
    destroyElement(HalteNr1B) 
    destroyElement(HalteNr1) 
    triggerClientEvent ( thePlayer, "Schrott", getRootElement() ) 
    HalteNr2 = createMarker ( -1923, -1785, 32, "checkpoint", 10, 125, 0, 0, 255, thePlayer ) 
    HalteNr2B = createBlip ( -1923, -1785, 32, 0, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) 
    addEventHandler("onMarkerHit", HalteNr2, dMarker) 
end 

When I hit the first marker, both sounds are played.

When I hit the second marker, just the "nHalt" is played.

How can I change the script, that both sounds are played? Everything is in the meta.xml

No errors are shown

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted

ClientSide ....

function nHalt() 
local sound = playSound("sounds/Bus/nHalt.ogg") 
end 
addEvent("N", true) 
addEventHandler("N", getRootElement(), nHalt) 
function lt() 
nHalt() 
local ltr = playSound("sounds/Bus/Bushaltestellen/LTR.ogg") 
end 
addEvent("LTR", true) 
addEventHandler("LTR", getRootElement(), lt) 
  
function SchrottP() 
nHalt() 
local schrott = playSound("sounds/Bus/Bushaltestellen/Schrott.ogg") 
end 
addEvent("Schrott", true) 
addEventHandler("Schrott", getRootElement(), SchrottP) 
  
function AngelP() 
nHalt() 
local angel = playSound("sounds/Bus/Bushaltestellen/Angel.ogg") 
end 
addEvent("Angel", true) 
addEventHandler("Angel", getRootElement(), AngelP) 

ServerSide ....

local HalteNr1 
function startJob(thePlayer) 
HalteNr1 = createMarker ( -2435, -595, 132, "checkpoint", 10, 125, 0, 0, 255, thePlayer ) 
HalteNr1B = createBlip ( -2435, -595, 132, 0, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) 
triggerClientEvent ( thePlayer, "LTR", getRootElement() ) 
triggerClientEvent ( thePlayer, "infobox_start", getRootElement(), "\nDienst gestartet!", 5000, 125, 0, 0 ) 
addEventHandler("onMarkerHit", HalteNr1, cMarker) 
end 
  
local HalteNr2 
function cMarker(thePlayer) 
    local money = vioGetElementData(thePlayer, "money") 
    vioSetElementData ( thePlayer, "money", tonumber(money)+50 ) 
    givePlayerMoney(thePlayer, 50) 
    destroyElement(HalteNr1B) 
    destroyElement(HalteNr1) 
    triggerClientEvent ( thePlayer, "Schrott", getRootElement() ) 
    triggerClientEvent ( thePlayer, "N", getRootElement() ) 
    HalteNr2 = createMarker ( -1923, -1785, 32, "checkpoint", 10, 125, 0, 0, 255, thePlayer ) 
    HalteNr2B = createBlip ( -1923, -1785, 32, 0, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) 
    addEventHandler("onMarkerHit", HalteNr2, dMarker) 
  

 and tell me if it work

Posted

No. You just added an Event. No real changes.

No error and so on.

But thank you

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted
myabe you have to Put x,y,z for Play Sound

Like This example

https://wiki.multitheftauto.com/wiki/PlaySound3D

PlaySound is not the same as PlaySound3D. PlaySound does it globally, 3D does it locally.

The problem in the script is that you don't have setSoundVolume there.

Do this to get it working (client-side):

  
function nHalt() 
local sound = playSound("sounds/Bus/nHalt.ogg") 
setSoundVolume(sound, 1.0) -- Valid: 0-1 
end 
  
function lt() 
nHalt() 
local ltr = playSound("sounds/Bus/Bushaltestellen/LTR.ogg") 
setSoundVolume(ltr, 1.0) -- Valid: 0-1 
end 
addEvent("LTR", true) 
addEventHandler("LTR", getRootElement(), lt) 
  
function SchrottP() 
nHalt() 
local schrott = playSound("sounds/Bus/Bushaltestellen/Schrott.ogg") 
setSoundVolume(schrott, 1.0) -- Valid: 0-1 
end 
addEvent("Schrott", true) 
addEventHandler("Schrott", getRootElement(), SchrottP) 
  
function AngelP() 
nHalt() 
local angel = playSound("sounds/Bus/Bushaltestellen/Angel.ogg") 
setSoundVolume(angel, 1.0) -- Valid: 0-1 
end 
addEvent("Angel", true) 
addEventHandler("Angel", getRootElement(), AngelP) 
  

If I helped you, please click the like button on the right ;) Thanks!

Posted

client

function nHalt() 
    local sound = playSound("sounds/Bus/nHalt.ogg") 
end 
addEvent("N", true) 
addEventHandler("N", getRootElement(), nHalt) 
  
function lt() 
    nHalt() 
    local ltr = playSound("sounds/Bus/Bushaltestellen/LTR.ogg") 
end 
addEvent("LTR", true) 
addEventHandler("LTR", getRootElement(), lt) 
  
function SchrottP() 
    nHalt() 
    local schrott = playSound("sounds/Bus/Bushaltestellen/Schrott.ogg") 
end 
addEvent("Schrott", true) 
addEventHandler("Schrott", getRootElement(), SchrottP) 
  
function AngelP() 
    nHalt() 
    local angel = playSound("sounds/Bus/Bushaltestellen/Angel.ogg") 
end 
addEvent("Angel", true) 
addEventHandler("Angel", getRootElement(), AngelP) 

server

local HalteNr1 
function startJob(thePlayer) 
    HalteNr1 = createMarker ( -2435, -595, 132, "checkpoint", 10, 125, 0, 0, 255, thePlayer ) 
    HalteNr1B = createBlip ( -2435, -595, 132, 0, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) 
    triggerClientEvent ( thePlayer, "LTR", getRootElement() ) 
    triggerClientEvent ( thePlayer, "infobox_start", getRootElement(), "\nDienst gestartet!", 5000, 125, 0, 0 ) 
    addEventHandler("onMarkerHit", HalteNr1, cMarker) 
end 
  
local HalteNr2 
function cMarker(thePlayer) 
    local money = vioGetElementData(thePlayer, "money") 
    vioSetElementData ( thePlayer, "money", tonumber(money)+50 ) 
    givePlayerMoney(thePlayer, 50) 
    destroyElement(HalteNr1B) 
    destroyElement(HalteNr1) 
    triggerClientEvent ( thePlayer, "Schrott", getRootElement() ) 
    triggerClientEvent ( thePlayer, "N", getRootElement() ) 
    HalteNr2 = createMarker ( -1923, -1785, 32, "checkpoint", 10, 125, 0, 0, 255, thePlayer ) 
    HalteNr2B = createBlip ( -1923, -1785, 32, 0, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) 
    addEventHandler("onMarkerHit", HalteNr2, dMarker) 
end 

xthepr0mise you forgot end in function cMarker

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted
I already added it when I was trying it. But it is the same.

How you call function startJob()?

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted (edited)
bindKey ( thePlayer, "sub_mission", "down", startJob ) 

Full code please

Try for test :

  
addEventHandler("onResourceStart",resourceRoot, 
    function() 
        for i,v in ipairs(getElementsByType("player")) do 
            bindKey ( v, "F3", "down", startJob ) 
        end 
    end 
)    
  

Key:F3

Edited by Guest

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted
  
function enterVehicle ( thePlayer, seat, jacked ) 
    local passenger = getVehicleOccupant( source, 1 ) 
    local preis = 100 
    if busVehicles[getElementModel ( source )]  then 
        if seat == 0 then 
            if vioGetElementData ( thePlayer, "job" ) == "busfahrer" then 
                bindKey ( thePlayer, "sub_mission", "down", startJob ) 
                triggerClientEvent ( thePlayer, "infobox_start", getRootElement(), "\nDruecke die spezial-\nmissionen-Taste,\num in den Dienst\nzu gehen!", 5000, 125, 0, 0 ) 
            else 
                triggerClientEvent ( thePlayer, "infobox_start", getRootElement(), "\nDu bist kein Busfahrer!", 5000, 125, 0, 0 ) 
            end 
        end 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) 
  

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted

There isn't any sound at all when I press F3. Also there isn't any marker or something else.

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted

First off, which of those both

17. triggerClientEvent ( thePlayer, "Schrott", getRootElement() )

18. triggerClientEvent ( thePlayer, "N", getRootElement() )

is played?

Second:

Does the file not played:

1) Exist client side

2) Can it be played by the windows media player?

Third:

Did you ever use a debugscript to ensure that the client side event really gets called?

Officially MTA's worst fanboy

default.pngdefault.png

default.pngdefault.pngdefault.png

Posted

1. "N"

2. Yes and it can be played in VLC because it is a .ogg and "N" executes also a .ogg file.

3. Yes there aren't any errors concerning this script

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted

I wanted to ask if the file is valid and not defective.

Also, you didn't tell me if the file exists, in the client side /mods/deathmatch/resources folder.

As you said yourself, "the script works".

Officially MTA's worst fanboy

default.pngdefault.png

default.pngdefault.pngdefault.png

Posted

Oh ok. I wrote it already in my posts before but :

It is valid. The file exists or it would ouput an error in my meta.

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%

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