Jump to content

ShiDiNips

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by ShiDiNips

  1. "lastTrigger" wasn't recognized that's why It keeps calling and spamming the "onClientPlaySound" every minute which makes the server and the players lag
  2. how about this? -- server function timeFunction(sourcePlayer) local timehour = getTime() if timehour == 6 or timehour == 7 or timehour == 8 or timehour == 9 or timehour == 10 or timehour == 11 or timehour == 12 or timehour == 13 or timehour == 14 or timehour == 15 or timehour == 16 or timehour == 17 or timehour == 18 or timehour == 19 then triggerClientEvent(getRootElement(), "onClientPlaySound", resourceRoot) triggerClientEvent(getRootElement(), "onClientPlaySoundAmb", resourceRoot) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), timeFunction) function timeFunctionNight(sourcePlayer) local timehour, timeminute = getTime() if timehour == 20 or timehour == 21 or timehour == 22 or timehour == 23 or timehour == 0 or timehour == 1 or timehour == 2 or timehour == 3 or timehour == 4 or timehour == 5 then triggerClientEvent(getRootElement(), "onClientPlaySoundNight", resourceRoot) triggerClientEvent(getRootElement(), "onClientPlaySoundAmbNight", resourceRoot) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), timeFunctionNight) but on debugscript, it says "ERROR: Server triggered clientside event onClientPlaySound, but event is not added clientside" it's added in the client file
  3. If I do setTimer(theFunction, 60000,0) it will repeat the sound every 1 minute and that will be annoying tho
  4. Because I have this... local locationstown = { {-90.736328125, 1122.5888671875, 0}, {-1475.625, 2629.337890625, 0}, {-2445.4267578125, 2388.9111328125, 0} } for i=1 ,#locationstown do local xtown, ytown, ztown = locationstown[i][1], locationstown[i][2], locationstown[i][3] function ambtowntiming() local realtime = getRealTme() local hours = realtime.hour local minutes = realtime.minute if hours == 06 and minutes == 30 then ambtown = playSound3D("ambtown.mp3", xtown, ytown, ztown, true) setSoundMaxDistance(ambtown, 1000) setSoundPanningEnabled (ambtown, false) stopSound(ambtownnight) elseif hours == 22 and minutes == 30 then ambtownnight = playSound3D("ambtownnight.mp3", xtown, ytown, ztown, true) setSoundMaxDistance(ambtownnight, 1000) setSoundPanningEnabled (ambtownnight, false) stopSound(ambtown) end end end -- everything in client function sorry for double quote
  5. Yes, it seems like it dont work for me
  6. -- client local locsfortown:~ = { {-86.4970703125, 1120.2216796875, 0}, {-1475.625, 2629.337890625, 0}, {-2445.4267578125, 2388.9111328125, 0} } for i=1 ,#locsfortown:~ do function onClientPlaySound() xtown, ytown, ztown = locsfortown:~[i][1], locsfortown:~[i][2], locsfortown:~[i][3] ambtown = playSound3D("ambtown.mp3", xtown, ytown, ztown, true) setSoundMaxDistance(ambtown, 1000) setSoundPanningEnabled (ambtown, false) end end addEvent("onClientPlaySound", true) addEventHandler("onClientPlaySound", resourceRoot, onClientPlaySound) -- server function timeFunction() local realtime = getRealTime() local hours = realtime.hour local minutes = realtime.minute if hours == 07 and minutes == 00 then triggerClientEvent(getRootElement(), "onClientPlaySound", resourceRoot) end end setTimer(timeFunction, 60000, 0)
  7. realtime says nil hours says nil minutes says nil
  8. Weirdly enough, still doesn't work and no bugs were found in /debugscript 3
  9. You mean like this? Client: function playdaysound() sound = playSound3D("daytime.mp3", x, y, z, true) setSoundMaxDistance(sound , 1000) setSoundPanningEnabled (sound , false) end addEvent("playdemsound", true) addEventHandler ( "playdemsound", getLocalPlayer(), playdaysound ) Server: setTimer(function daytime() local realtime = getRealTime() local hours = realtime.hour local minutes = realtime.minute if hours == 07 and minutes == 00 then triggerClientEvent("playdemsound") end end, 1, source)
  10. If you meant like.. "onResourceStart", I already did that.. Also, isn't setTimer will only play something if the time set to setTimer is finished? That's why I was hoping that I could play sound using the game time
  11. If you're looking for a way to make GUI visible via key, use bindKey
  12. Hello guys, new here.. So I was making this script where it plays a sound on a location.. Let's say it's' 07:00 on game it plays "daytime.mp3" and when it's 22:00 on game it plays "nighttime.mp3". Here's the code I made in clientside function daytime() local hour, minute = getTime() if (hour == 07 and minute == 00) then sound = playSound3D("daytime.mp3", x, y, z, true) setSoundMaxDistance(sound , 1000) setSoundPanningEnabled (sound , false) end end Thanks in advance I already tried function daytime() local realtime = getRealTime() local hours = realtime.hour local minutes = realtime.minute if (hours == 07 and minutes == 00) then sound = playSound3D("daytime.mp3", x, y, z, true) setSoundMaxDistance(sound , 1000) setSoundPanningEnabled (sound , false) end end Still the same, it doesn't work. I also did outputDebugString(realtime) outputDebugString(hour, minute) it shows nil
×
×
  • Create New...