BriGhtx3 Posted October 3, 2011 Posted October 3, 2011 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
^Dev-PoinT^ Posted October 3, 2011 Posted October 3, 2011 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
BriGhtx3 Posted October 3, 2011 Author Posted October 3, 2011 No. You just added an Event. No real changes. No error and so on. But thank you
^Dev-PoinT^ Posted October 3, 2011 Posted October 3, 2011 myabe you have to Put x,y,z for Play Sound Like This example https://wiki.multitheftauto.com/wiki/PlaySound3D
myonlake Posted October 3, 2011 Posted October 3, 2011 myabe you have to Put x,y,z for Play SoundLike 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)
Kenix Posted October 3, 2011 Posted October 3, 2011 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
BriGhtx3 Posted October 3, 2011 Author Posted October 3, 2011 I already added it when I was trying it. But it is the same.
Kenix Posted October 3, 2011 Posted October 3, 2011 I already added it when I was trying it. But it is the same. How you call function startJob()?
BriGhtx3 Posted October 3, 2011 Author Posted October 3, 2011 bindKey ( thePlayer, "sub_mission", "down", startJob )
Kenix Posted October 3, 2011 Posted October 3, 2011 (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 October 3, 2011 by Guest
BriGhtx3 Posted October 3, 2011 Author Posted October 3, 2011 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 )
BriGhtx3 Posted October 3, 2011 Author Posted October 3, 2011 There isn't any sound at all when I press F3. Also there isn't any marker or something else.
Phat Looser Posted October 4, 2011 Posted October 4, 2011 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?
BriGhtx3 Posted October 4, 2011 Author Posted October 4, 2011 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
Phat Looser Posted October 4, 2011 Posted October 4, 2011 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".
BriGhtx3 Posted October 4, 2011 Author Posted October 4, 2011 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.
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