Garry's Mod

[HELP] Need script playSound when player get specific job

Submitted by heret1c, , Thread ID: 239387

Thread Closed

RE: [HELP] Need script playSound when player get specific job

This post was last modified: 05-04-2022, 07:58 PM by Bambi_ID
#2
Maybe something like

The code below can be added to playerinitialspawn in job.lua so when they spawn as the job/role
Code:
--To all players
for k, v in pairs(player.GetAll())do
--Play sound file can be .mp3
sound.Play( "ambient/explosions/exp1.wav", v:GetPos() )

end

--Whats set in this example ply:GetJob()
local blacklisted_jobs = {
"Civilian",
"SCP001",
"SCP002",
"SCP003"
}

for k, v in pairs(player.GetAll())do
--Loop Through Blacklisted jobs
for i, t in pairs(blacklisted_jobs)do
--For Specific job. Depends on how gamemode set up for GetJob() function
if !(v:GetJob() == t)
--Play sound file can be .mp3
sound.Play( "ambient/explosions/exp1.wav", v:GetPos() )

end

end

end

Users browsing this thread: