Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 13/09/23 in all areas

  1. 1 point
  2. It is not necessary to create the marker on the server and then do a trigger, it can work perfectly if you do everything on the client Marker = createMarker( 1508.814453125 , -1144.19921875 , 140.93536376953, "cylinder", 1, 255, 0, 0) addEventHandler("onClientMarkerHit", Marker, function(element, dim) if element == localPlayer and dim then if not dm_window then dm_window = guiCreateWindow(0.1556,0.1597,0.6375,0.6944,"Team-Panel",true) grove_button = guiCreateButton(10,108,162,165,"Team-1",false,dm_window) police_button = guiCreateButton(285,108,162,165,"Team-2",false,dm_window) teams_label = guiCreateLabel(159,44,145,47,"",false,dm_window) else guiSetVisible(dm_window, true) end showCursor(true) end end ) But if you still want to continue doing it with a server to client trigger, I'll leave you how to do it server Marker = createMarker( 1508.814453125 , -1144.19921875 , 140.93536376953, "cylinder", 1, 255, 0, 0) function openwindow(thePlayer, dim) local elementType = getElementType(thePlayer) if elementType == "player" and dim then triggerClientEvent(thePlayer,"opengui1window", thePlayer) end end addEventHandler("onMarkerHit", Marker, openwindow) client addEvent("opengui1window", true) addEventHandler("opengui1window", root, function() if not dm_window then dm_window = guiCreateWindow(0.1556,0.1597,0.6375,0.6944,"Team-Panel",true) grove_button = guiCreateButton(10,108,162,165,"Team-1",false,dm_window) police_button = guiCreateButton(285,108,162,165,"Team-2",false,dm_window) teams_label = guiCreateLabel(159,44,145,47,"",false,dm_window) else guiSetVisible(dm_window, true) end showCursor(true) end )
    1 point
  3. This block: for theKey,theSound in pairs(spawnedSounds) do -- end was meant to be used separately from the code that starts the sounds. By putting it into the same block, you're stopping the sounds for all peds if the current ped has deadzombie set to true, as it loops through spawnedSounds table. I'd say your initial code is close enough, you just need to use spawnedSounds[peds] to refer to the current ped's sound. But then the warning will still be there, it happens because calling stopSound destroys the sound element, but the (no-longer-valid) handle is still in spawnedSounds table, so when it gets passed to stopSound the next time, you get a warning. You can remove a value from the table by assigning nil to it, so destroying the current ped's sound would look like this: stopSound(spawnedSounds[peds]) -- stop the sound, destroy the sound element spawnedSounds[peds] = nil -- remove the no-longer-existing element from the table But even then, I can think of scenarios where things go wrong. Like for example the loop is executed every 6 seconds, so you call playSound3D and store the result to spawnedSounds[peds] repeatedly, meaning the sound element from the previous execution is still overwritten by new sound element. So the next stopSound call will only stop the ped's most recent sound. I guess the right way to handle this depends on your needs, but in any case, assuming you clean up the sounds from the table after stopping them, you can check if the sound from earlier executions exists by directly checking the value in the table: if spawnedSounds[peds] then -- called if the sound exists else -- called if the sound doesn't exist end
    1 point
×
×
  • Create New...