Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local LoadedSounds
- if CLIENT then
- LoadedSounds = {} -- this table caches existing CSoundPatches
- end
- local function ReadSound( FileName )
- local sound
- local filter
- if SERVER then
- filter = RecipientFilter()
- filter:AddAllPlayers()
- end
- if SERVER or !LoadedSounds[FileName] then
- -- The sound is always re-created serverside because of the RecipientFilter.
- sound = CreateSound( game.GetWorld(), FileName, filter ) -- create the new sound, parented to the worldspawn ( which always exists )
- if sound then
- sound:SetSoundLevel( 0 ) -- play everywhere
- if CLIENT then
- LoadedSounds[FileName] = { sound, filter } -- cache the CSoundPatch
- end
- end
- else
- sound = LoadedSounds[FileName][1]
- filter = LoadedSounds[FileName][2]
- end
- if sound then
- if CLIENT then
- sound:Stop() -- it won't play again otherwise
- end
- sound:Play()
- end
- return sound -- useful if you want to stop the sound yourself
- end
- -- When we are ready, we play the sound:
- timer.Simple( 0, function() PrintMessage( HUD_PRINTCENTER,"Attention Server Restart In 30 Seconds" ) end )
- timer.Simple( 3, function() PrintMessage( HUD_PRINTCENTER,"Attention Server Restart In 30 Seconds" ) end )
- timer.Simple( 6, function() PrintMessage( HUD_PRINTCENTER,"Attention Server Restart In 30 Seconds" ) end )
- timer.Simple( 9, function() PrintMessage( HUD_PRINTCENTER,"Attention Server Restart In 30 Seconds" ) end )
- timer.Simple( 12, function() PrintMessage( HUD_PRINTCENTER,"Attention Server Restart In 30 Seconds" ) end )
- timer.Simple( 15, function() PrintMessage( HUD_PRINTCENTER,"Attention Server Restart In 30 Seconds" ) end )
- timer.Simple( 18, function() PrintMessage( HUD_PRINTCENTER,"Attention Server Restart In 30 Seconds" ) end )
- timer.Simple( 24, function() PrintMessage( HUD_PRINTCENTER,"Attention Server Restart In 30 Seconds" ) end )
- timer.Simple( 27, function() PrintMessage( HUD_PRINTCENTER,"Attention Server Restart In 30 Seconds" ) end )
- timer.Simple( 30, function() PrintMessage( HUD_PRINTCENTER,"Attention Server Restart In 30 Seconds" ) end )
- timer.Simple( 33, function() PrintMessage( HUD_PRINTCENTER,"Attention Server Restart In 30 Seconds" ) end )
- timer.Simple( 36, function() PrintMessage( HUD_PRINTCENTER,"Attention Server Restart In In 30 Seconds" ) end )
- ReadSound( "ambient/alarms/alarm_citizen_loop1.wav" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement