Jump to content

Sound problem.


denny199

Recommended Posts

Hello, I got a problem with my new script, i was attaching the sound to my car, ofc for evryone but then someone else attached the sound to, but then i pressed the stop button then the sound was stopped by him but not by me.

but i want to stop the sound only for the player who clicked on that button. but didn't work

Here's my code:

CLIENT SIDE

  
  
local sounds = {} 
function testsound1 ( vehicle, path, stationPath ) 
sirene = playSound3D (path, 0,0,0) 
    attachElements ( sirene, vehicle) 
setSoundVolume(sirene, 0.7) 
    sounds [ vehicle ] = sirene      
    end 
addEvent( "testsound", true ) 
addEventHandler("testsound", getRootElement(), testsound1) 
  
  
function stopsound () 
pl = getLocalPlayer() 
  
--local sirene = sounds [ vehicle ] 
stopSound ( sirene ) 
--outputChatBox ( "klaar met triggeren") 
--destroyElement ( sirene ) 
  
end 
addEvent( "testsoundremove", true ) 
addEventHandler("testsoundremove", getRootElement(), stopsound) 
  
  
  
stationsNames = {} 
stations = {} 
  
  
function onGuiClick3 (button, state, x,y) 
    if source == GUIEditor_Button[3] and state == "up" then  
        local selected = guiGridListGetSelectedItem (GUIEditor_Grid[1]) 
        if selected then 
            local stationName = guiGridListGetItemText (GUIEditor_Grid[1], selected, GUIEditor_column) 
            if stationName then 
triggerServerEvent ("attachomg", getLocalPlayer(), getLocalPlayer(), stationName) 
end 
end 
end 
end 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[3], onGuiClick3, true ) 
  
  
function onGuiClick4 (button, state, x,y) 
    if source == GUIEditor_Button[4] and state == "up" then 
triggerServerEvent ( "testsoundwegserver", getRootElement(), com, stationPath,newX, newY, newZ) 
end 
end 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[4], onGuiClick4, true ) 

SERVER SIDE

  
  
function getPointFromDistanceRotation(x, y, dist, angle) 
    local a = math.rad(angle+90) 
    local plusX = math.cos(a) * dist 
    local plusY = math.sin(a) * dist 
    return x+plusX, y+plusY 
end 
  
xmlFile = xmlLoadFile ("radios.xml") 
  
radios = {} 
stations = {} 
stationsNames = {} 
  
function loadStations () 
    if xmlFile then 
        local children = xmlNodeGetChildren (xmlFile) 
        for k,v in ipairs(children) do 
            local radioTable = xmlNodeGetAttributes (v) 
            for name,value in pairs(radioTable) do 
                --outputChatBox (tostring(value)) 
                if name == "name" then 
                    stationName = value 
                elseif name == "path" then 
                    stationPath = value 
                end 
                 
            end 
            stations[stationName] = stationPath 
            table.insert (stationsNames, 1, stationName) 
        end 
        table.sort (stationsNames) 
    end 
end 
loadStations () 
  
  
function attachradio2 (player,station) 
    --if station then 
        local stationPath = stations[station] 
        --if stationPath then 
  
    local x,y,z = getElementPosition( player ) 
    local rx,ry,rz = getElementRotation ( player ) 
    local newX, newY = getPointFromDistanceRotation (x,y, 1.5, rz) 
    local newZ = z - 1 
             
  
outputChatBox ( "triggering sucses") 
    local com = getPedOccupiedVehicle(player) 
         triggerClientEvent ( "testsound", getRootElement(), com, stationPath,newX, newY, newZ) 
  
            --triggerClientEvent ("onNewRadioCreate", getRootElement(), newX, newY, newZ, stationPath)  
            outputChatBox ("New station: " .. station .. " created, path: " .. tostring(stationPath), 0,220,0) 
            table.insert (radios, 1, {newX, newY, newZ, stationPath})  
    end 
addEvent ("attachomg", true) 
addEventHandler ("attachomg", getRootElement(), attachradio2) 
  
  
  
  
function testsoundwegserver2 (player,station) 
outputChatBox ( "triggering sucsesNAARSERVERSIDE") 
         triggerClientEvent ( "testsoundremove", getRootElement(), com) 
    end 
addEvent ("testsoundwegserver", true) 
addEventHandler ("testsoundwegserver", getRootElement(),testsoundwegserver2) 
  
  

i tryed this to:

[ LOCAL as local]

LOCAL sirene = playSound3D (path, 0,0,0) 

but then the sound wasn't dissapeared

Link to comment

ok, i tryed this:

didn't work:

-- removed the other stuff

cl:

local sounds = {} 
function testsound1 ( vehicle, path, stationPath ) 
sirene = playSound3D (path, 0,0,0) 
    attachElements ( sirene, vehicle) 
setSoundVolume(sirene, 0.7) 
    sounds [ vehicle ] = sirene      
    end 
addEvent( "testsound", true ) 
addEventHandler("testsound", getRootElement(), testsound1) 
  
  
function stopsound (player, source) 
pl = getLocalPlayer() 
--local sirene = sounds [ vehicle ] 
stopSound ( sirene ) 
outputChatBox ( "gelukt") 
--destroyElement ( sirene ) 
end 
addEvent( "testsoundremove", true ) 
addEventHandler("testsoundremove", getRootElement(), stopsound) 
  
function onGuiClick4 (button, state, x,y) 
    if source == GUIEditor_Button[4] and state == "up" then 
triggerServerEvent ( "testsoundwegserver", getLocalPlayer(), getLocalPlayer(), com, stationPath,newX, newY, newZ, getLocalPlayer()) 
end 
end 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[4], onGuiClick4, true ) 
  

server:

function testsoundwegserver2 (player,station) 
local com = getPedOccupiedVehicle ( player ) 
outputChatBox ( "triggering sucsesNAARSERVERSIDE") 
         triggerClientEvent (player,"testsoundremove", getRootElement(), com, sirene) 
--it's trggering good, but only for the last player who attached. 
-- source didn't work to. 
    end 
addEvent ("testsoundwegserver", true) 
addEventHandler ("testsoundwegserver", getRootElement(),testsoundwegserver2) 

edit: or must i store the sound with setelementData

Link to comment

Server-side:

function testsoundwegserver2 (player,station) 
local com = getPedOccupiedVehicle ( player ) 
outputChatBox ( "triggering sucsesNAARSERVERSIDE") 
         triggerClientEvent ("testsoundremove", player, com, sirene) -- what is 'sirene' ? 
--it's trggering good, but only for the last player who attached. 
-- source didn't work to. 
    end 
addEvent ("testsoundwegserver", true) 
addEventHandler ("testsoundwegserver", getRootElement(),testsoundwegserver2) 

Link to comment

Ok, i was a while inactive was busy with school, but now here's my code, whole [ removed attach caus that works fine]

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Window[1] = guiCreateWindow(436,285,486,412,"Box In A Car -- BIAC",false) 
  
GUIEditor_Grid[1] = guiCreateGridList(21,144,183,259,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
guiWindowSetSizable (GUIEditor_Window[1], false) 
GUIEditor_column = guiGridListAddColumn(GUIEditor_Grid[1],"Muziek",0.9) 
  
  
GUIEditor_Button[3] = guiCreateButton(251,154,175,49,"Play",false,GUIEditor_Window[1]) 
  
GUIEditor_Button[4] = guiCreateButton(251,254,175,49,"Stop",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(258,331,82,80,"Version 1.0",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],255, 0 ,0) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
guiSetVisible (GUIEditor_Window[1], false )  
  
  
  
  
function guiToggle (player )   
player = getLocalPlayer()       
        if ( guiGetVisible ( GUIEditor_Window[1] ) == true ) then  
           guiSetVisible (GUIEditor_Window[1], false )  
showCursor ( false )      
        else               
                guiSetVisible ( GUIEditor_Window[1], true )  
showCursor ( true ) 
end 
end 
bindKey ( "f2", "down", guiToggle )  
  
  
  
  
  
  
  
  
  
  
local sounds = {} 
function testsound1 ( vehicle, path, stationPath ) 
sirene = playSound3D (path, 0,0,0) 
    attachElements ( sirene, vehicle) 
setSoundVolume(sirene, 0.7) 
    sounds [ vehicle ] = sirene      
    end 
addEvent( "testsound", true ) 
addEventHandler("testsound", getRootElement(), testsound1) 
  
  
function stopsound (player, source) 
pl = getLocalPlayer() 
--local sirene = sounds [ vehicle ] 
stopSound ( sirene ) 
outputChatBox ( "gelukt") 
--destroyElement ( sirene ) 
end 
addEvent( "testsoundremove", true ) 
addEventHandler("testsoundremove", getRootElement(), stopsound) 
  
  
  
  
stationsNames = {} 
stations = {} 
  
  
function onGuiClick3 (button, state, x,y) 
    if source == GUIEditor_Button[3] and state == "up" then  
        local selected = guiGridListGetSelectedItem (GUIEditor_Grid[1]) 
        if selected then 
            local stationName = guiGridListGetItemText (GUIEditor_Grid[1], selected, GUIEditor_column) 
            if stationName then 
triggerServerEvent ("attachomg", getLocalPlayer(), getLocalPlayer(), stationName) 
end 
end 
end 
end 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[3], onGuiClick3, true ) 
  
  
function onGuiClick4 (button, state, x,y) 
    if source == GUIEditor_Button[4] and state == "up" then 
triggerServerEvent ( "testsoundwegserver", getLocalPlayer(), getLocalPlayer(), com, stationPath,newX, newY, newZ, getLocalPlayer()) 
end 
end 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[4], onGuiClick4, true ) 
  
  
  
function onStart () 
    triggerServerEvent ("requestForRadios", getLocalPlayer(), getLocalPlayer()) 
end 
addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), onStart) 
  
function onJoin (radia, names, st) 
    stationsNames = names 
    stations = st 
    for k,v in ipairs(stationsNames) do 
        local row = guiGridListAddRow ( GUIEditor_Grid[1]) 
        guiGridListSetItemText (GUIEditor_Grid[1], row, GUIEditor_column, v, false, false ) 
    end 
end 
addEvent ("sendAllRadios", true) 
addEventHandler ("sendAllRadios", getRootElement(), onJoin) 
  
  
  

server

  
  
  
  
function getPointFromDistanceRotation(x, y, dist, angle) 
    local a = math.rad(angle+90) 
    local plusX = math.cos(a) * dist 
    local plusY = math.sin(a) * dist 
    return x+plusX, y+plusY 
end 
  
xmlFile = xmlLoadFile ("radios.xml") 
  
radios = {} 
stations = {} 
stationsNames = {} 
  
function loadStations () 
    if xmlFile then 
        local children = xmlNodeGetChildren (xmlFile) 
        for k,v in ipairs(children) do 
            local radioTable = xmlNodeGetAttributes (v) 
            for name,value in pairs(radioTable) do 
                --outputChatBox (tostring(value)) 
                if name == "name" then 
                    stationName = value 
                elseif name == "path" then 
                    stationPath = value 
                end 
                 
            end 
            stations[stationName] = stationPath 
            table.insert (stationsNames, 1, stationName) 
        end 
        table.sort (stationsNames) 
    end 
end 
loadStations () 
  
  
function attachradio2 (player,station) 
    --if station then 
        local stationPath = stations[station] 
        --if stationPath then 
  
    local x,y,z = getElementPosition( player ) 
    local rx,ry,rz = getElementRotation ( player ) 
    local newX, newY = getPointFromDistanceRotation (x,y, 1.5, rz) 
    local newZ = z - 1 
             
  
outputChatBox ( "triggering sucses") 
    local com = getPedOccupiedVehicle(player) 
         triggerClientEvent ( "testsound", player, com, stationPath,newX, newY, newZ) 
  
            --triggerClientEvent ("onNewRadioCreate", getRootElement(), newX, newY, newZ, stationPath)  
            --outputChatBox ("New station: " .. station .. " created, path: " .. tostring(stationPath), 0,220,0) 
            table.insert (radios, 1, {newX, newY, newZ, stationPath})  
    end 
addEvent ("attachomg", true) 
addEventHandler ("attachomg", getRootElement(), attachradio2) 
  
  
function onJoin (player) 
    if radios then 
        triggerClientEvent (player, "sendAllRadios", getRootElement(), radios, stationsNames, stations) 
    end 
end 
addEvent ("requestForRadios", true) 
addEventHandler ("requestForRadios", getRootElement(), onJoin) 
  
  
function testsoundwegserver2 (player,station) 
local com = getPedOccupiedVehicle ( player ) 
outputChatBox ( "triggering sucsesNAARSERVERSIDE") 
         triggerClientEvent ("testsoundremove", source, com, sirene) 
    end 
addEvent ("testsoundwegserver", true) 
addEventHandler ("testsoundwegserver", getRootElement(),testsoundwegserver2) 
  

Link to comment

Big fail :/

Client side

triggerServerEvent ("requestForRadios", getLocalPlayer(), getLocalPlayer()) 

You already trigger source with localPlayer. Why you trigger next argument localPlayer again?

Should be

triggerServerEvent ( 'requestForRadios', localPlayer ) 

Server side

function onJoin (player) 
    if radios then 
        triggerClientEvent (player, "sendAllRadios", getRootElement(), radios, stationsNames, stations) 
    end 
end 
addEvent ("requestForRadios", true) 
addEventHandler ("requestForRadios", getRootElement(), onJoin) 

Should be

function onJoin ( ) 
    if radios then 
        triggerClientEvent ( source, "sendAllRadios", root, radios, stationsNames, stations ) 
    end 
end 
addEvent ( "requestForRadios", true ) 
addEventHandler ( "requestForRadios", root, onJoin ) 

denny199, What the problem?

Link to comment

Ok, sorry for this LOOOO-O-O-ONG waiting but u know school goes first.

Ok, kennix, it didn't work but i will say it better;

I'm attaching a music/sound to my car with this script.

U're attaching later a music/sound to ur car, while my sound is still playing

After i think, hmmm this sound is bored, I press the stop button.

[ I press the stop button ]

My sound doesn't go away,

But your'e music/sound is going away, that's it.

Link to comment

try this: Client-side

addEventHandler ("onClientResourceStart",resourceRoot,function() 
    triggerServerEvent ("requestForRadios",localPlayer) 
end) 
  
BIAC = guiCreateWindow(436,285,486,412,"Box In A Car -- BIAC",false) 
mList = guiCreateGridList(21,144,183,259,false,BIAC) 
guiGridListSetSelectionMode(mList,2) 
guiWindowSetSizable (BIAC, false) 
GUIEditor_column = guiGridListAddColumn(mList,"Muziek",0.9) 
--Buttons 
playM = guiCreateButton(251,154,175,49,"Play",false,BIAC) 
stopM = guiCreateButton(251,254,175,49,"Stop",false,BIAC) 
--Label 
vSrn = guiCreateLabel(258,331,82,80,"Version 1.0",false,BIAC) 
guiLabelSetColor(vSrn,255, 0 ,0) 
guiSetFont(vSrn,"default-bold-small") 
  
guiSetVisible (BIAC, false ) 
  
function guiToggle() 
    if guiGetVisible (BIAC)then 
        guiSetVisible (BIAC,false) 
        showCursor(false) 
    else               
        guiSetVisible (BIAC,true) 
        showCursor (true) 
    end 
end 
bindKey ( "f2", "down", guiToggle ) 
  
--Button Events 
  
addEventHandler ( "onClientGUIClick", playM,function(button,state) 
    if(button == "left")and(state=="up")then 
        local selected = guiGridListGetSelectedItem (mList) 
        if selected then 
            local stationName = guiGridListGetItemText (mList, selected,1) 
            if stationName then 
                triggerServerEvent ("attachomg",localPlayer,stationName) 
            end 
        end 
    end 
end,false) 
  
addEventHandler ("onClientGUIClick", stopM,function(button,state) 
    if(button=="left")and(state == "up")then 
        triggerServerEvent ( "testsoundwegserver",localPlayer) 
    end 
end,false) 
  
--Other events 
  
local sounds = {} 
stationsNames = {} 
stations = {} 
  
addEvent( "testsound", true ) 
addEventHandler("testsound", root,function(vehicle,stationPath,x,y,z) 
    sirene = playSound3D (stationPath, 0,0,0) 
    attachElements ( sirene, vehicle) 
    setSoundVolume(sirene, 0.7) 
    sounds[vehicle] = sirene     
end) 
  
addEvent( "testsoundremove", true ) 
addEventHandler("testsoundremove",root,function(com) 
    local sirene = sounds [ vehicle ] 
    stopSound(sirene) 
    outputChatBox ( "gelukt") 
    destroyElement (sirene) 
end) 
  
addEvent ("sendAllRadios", true) 
addEventHandler ("sendAllRadios",root,function(radia, names, st) 
    stationsNames = names 
    stations = st 
    for k,v in ipairs(stationsNames) do 
        local row = guiGridListAddRow ( mList) 
        guiGridListSetItemText (mList, row, GUIEditor_column, v, false, false ) 
    end 
end) 

Server-side

radios = {} 
stations = {} 
stationsNames = {} 
  
addEvent ("requestForRadios", true) 
addEventHandler ("requestForRadios",root,function() 
    if radios then 
        triggerClientEvent (client,"sendAllRadios",root, radios, stationsNames, stations) 
    end 
end) 
  
function getPointFromDistanceRotation(x, y, dist, angle) 
    local a = math.rad(angle+90) 
    local plusX = math.cos(a) * dist 
    local plusY = math.sin(a) * dist 
    return x+plusX, y+plusY 
end 
  
 addEventHandler("onResourceStart",resourceRoot,function() 
    xmlFile = xmlLoadFile ("radios.xml") 
    if xmlFile then 
        local children = xmlNodeGetChildren(xmlFile) 
        for k,v in ipairs(children) do 
            for name,value in pairs(xmlNodeGetAttributes(v)) do 
                --outputChatBox (tostring(value)) 
                if(name == "name")then 
                    stationName = value 
                elseif(name == "path")then 
                    stationPath = value 
                end 
            end 
        end 
    end 
    stations[stationName] = stationPath 
    table.insert (stationsNames, 1, stationName) 
    table.sort (stationsNames) 
end) 
  
addEvent ("attachomg", true) 
addEventHandler ("attachomg",root,function(station) 
    if station then 
        local stationPath = stations[station] 
        if stationPath then 
            local x,y,z = getElementPosition(client) 
            local rx,ry,rz = getElementRotation (client) 
            local newX, newY = getPointFromDistanceRotation (x,y, 1.5, rz) 
            local newZ = z - 1 
            outputChatBox ("triggering sucses",client) 
            local com = getPedOccupiedVehicle(client) 
            triggerClientEvent (client,"testsound",root, com, stationPath,newX, newY, newZ) 
  
            --triggerClientEvent ("onNewRadioCreate", getRootElement(), newX, newY, newZ, stationPath) 
            --outputChatBox ("New station: " .. station .. " created, path: " .. tostring(stationPath), 0,220,0) 
            table.insert (radios, 1, {newX, newY, newZ, stationPath}) 
        end 
    end 
end) 
  
addEvent ("testsoundwegserver", true) 
addEventHandler ("testsoundwegserver",root,function() 
    local com = getPedOccupiedVehicle (client) 
    outputChatBox ( "triggering sucsesNAARSERVERSIDE",client) 
    triggerClientEvent (client,"testsoundremove",root,com) 
end) 

Link to comment

Client-side:

addEventHandler ( 'onClientResourceStart', resourceRoot, 
    function ( ) 
        triggerServerEvent ( 'requestForRadios', localPlayer ) 
    end 
) 
  
BIAC = guiCreateWindow(436,285,486,412,"Box In A Car -- BIAC",false) 
mList = guiCreateGridList(21,144,183,259,false,BIAC) 
guiGridListSetSelectionMode(mList,2) 
guiWindowSetSizable (BIAC, false) 
GUIEditor_column = guiGridListAddColumn(mList,"Muziek",0.9) 
--Buttons 
playM = guiCreateButton(251,154,175,49,"Play",false,BIAC) 
stopM = guiCreateButton(251,254,175,49,"Stop",false,BIAC) 
--Label 
vSrn = guiCreateLabel(258,331,82,80,"Version 1.0",false,BIAC) 
guiLabelSetColor(vSrn,255, 0 ,0) 
guiSetFont(vSrn,"default-bold-small") 
  
guiSetVisible ( BIAC, false ) 
  
bindKey ( 'f2', 'down', 
    function ( ) 
        guiSetVisible ( BIAC, not guiGetVisible ( BIAC ) ) 
        showCursor ( not isCursorShowing ( ) ) 
    end 
) 
  
addEventHandler ( 'onClientGUIClick', root, 
    function ( btn, btnState ) 
        if ( btn == 'left' and btnState == 'up' ) then 
            if ( source == playM ) then 
                local row, col = guiGridListGetSelectedItem ( mList ) 
                if ( row and col and row ~= -1 and col ~= -1 ) then 
                    local stationName = guiGridListGetItemText ( mList, row, col ) 
                    triggerServerEvent ( 'attachomg', localPlayer, tostring ( stationName ) ) 
                end 
            elseif ( source == stopM ) then 
                triggerServerEvent ( 'testsoundwegserver', localPlayer ) 
            end 
        end 
    end 
) 
  
--Other events 
  
local sounds = {} 
stationsNames = {} 
stations = {} 
  
addEvent( "testsound", true ) 
addEventHandler("testsound", root,function(vehicle,stationPath,x,y,z) 
    sirene = playSound3D (stationPath, 0,0,0) 
    attachElements ( sirene, vehicle) 
    setSoundVolume(sirene, 0.7) 
    sounds[vehicle] = sirene     
end) 
  
addEvent( "testsoundremove", true ) 
addEventHandler("testsoundremove",root,function(com) 
    local sirene = sounds [ vehicle ] 
    stopSound(sirene) 
    outputChatBox ( "gelukt") 
    destroyElement (sirene) 
end) 
  
addEvent ("sendAllRadios", true) 
addEventHandler ("sendAllRadios",root,function(radia, names, st) 
    stationsNames = names 
    stations = st 
    for k,v in ipairs(stationsNames) do 
        local row = guiGridListAddRow ( mList) 
        guiGridListSetItemText (mList, row, GUIEditor_column, tostring ( v ), false, false ) 
    end 
end) 

Server-side:

radios = {} 
stations = {} 
stationsNames = {} 
  
addEvent ("requestForRadios", true) 
addEventHandler ("requestForRadios",root,function() 
    if radios then 
        triggerClientEvent (client,"sendAllRadios",root, radios, stationsNames, stations) 
    end 
end) 
  
function getPointFromDistanceRotation(x, y, dist, angle) 
    local a = math.rad(angle+90) 
    local plusX = math.cos(a) * dist 
    local plusY = math.sin(a) * dist 
    return x+plusX, y+plusY 
end 
  
 addEventHandler("onResourceStart",resourceRoot,function() 
    xmlFile = xmlLoadFile ("radios.xml") 
    if xmlFile then 
        local children = xmlNodeGetChildren(xmlFile) 
        for k,v in ipairs(children) do 
            for name,value in pairs(xmlNodeGetAttributes(v)) do 
                --outputChatBox (tostring(value)) 
                if(name == "name")then 
                    stationName = value 
                elseif(name == "path")then 
                    stationPath = value 
                end 
            end 
        end 
    end 
    stations[stationName] = stationPath 
    table.insert (stationsNames, 1, stationName) 
    table.sort (stationsNames) 
end) 
  
addEvent ("attachomg", true) 
addEventHandler ("attachomg",root,function(station) 
    if station then 
        local stationPath = stations[station] 
        if stationPath then 
            local x,y,z = getElementPosition(client) 
            local rx,ry,rz = getElementRotation (client) 
            local newX, newY = getPointFromDistanceRotation (x,y, 1.5, rz) 
            local newZ = z - 1 
            outputChatBox ("triggering sucses",client) 
            local com = getPedOccupiedVehicle(client) 
            triggerClientEvent (client,"testsound",root, com, stationPath,newX, newY, newZ) 
  
            --triggerClientEvent ("onNewRadioCreate", getRootElement(), newX, newY, newZ, stationPath) 
            --outputChatBox ("New station: " .. station .. " created, path: " .. tostring(stationPath), 0,220,0) 
            table.insert (radios, 1, {newX, newY, newZ, stationPath}) 
        end 
    end 
end) 
  
addEvent ("testsoundwegserver", true) 
addEventHandler ("testsoundwegserver",root,function() 
    local com = getPedOccupiedVehicle (client) 
    outputChatBox ( "triggering sucsesNAARSERVERSIDE",client) 
    triggerClientEvent (client,"testsoundremove",root,com) 
end) 

Sorry if something is wrong, just test it.

Link to comment
What is "sounds [ vehicle ]" ? What is "vehicle" ?

Well, I don't know exactly, I had the attach part from this:

/viewtopic.php?f=91&t=31470&p=335826&hilit=sirene#p335826

But can we attach a data under elements?? and then destroy de element via the element data?

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