Initial commit
This commit is contained in:
5
gamemodes/darkrp/gamemode/modules/hobo/cl_hobo.lua
Normal file
5
gamemodes/darkrp/gamemode/modules/hobo/cl_hobo.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
hook.Add("PlayerBindPress", "Hobo sound", function(ply, bind, pressed)
|
||||
if ply == LocalPlayer() and ply:GetActiveWeapon():IsValid() and string.find(string.lower(bind), "attack2") and ply:GetActiveWeapon():GetClass() == "weapon_bugbait" then
|
||||
LocalPlayer():ConCommand("_hobo_emitsound")
|
||||
end
|
||||
end)
|
||||
35
gamemodes/darkrp/gamemode/modules/hobo/sv_hobo.lua
Normal file
35
gamemodes/darkrp/gamemode/modules/hobo/sv_hobo.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
local sounds = {
|
||||
{
|
||||
range = 14,
|
||||
path = "npc/zombie/zombie_voice_idle"
|
||||
},
|
||||
{
|
||||
range = 6,
|
||||
path = "npc/zombie/zombie_pain"
|
||||
},
|
||||
{
|
||||
range = 3,
|
||||
path = "npc/zombie/zombie_alert"
|
||||
}
|
||||
}
|
||||
|
||||
local function MakeZombieSoundsAsHobo(ply)
|
||||
if ply:EntIndex() == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
if not ply.nospamtime then
|
||||
ply.nospamtime = CurTime() - 2
|
||||
end
|
||||
|
||||
local t = ply:Team()
|
||||
if not RPExtraTeams[t] or not RPExtraTeams[t].hobo or CurTime() < (ply.nospamtime + 1.3) or (ply:GetActiveWeapon():IsValid() and ply:GetActiveWeapon():GetClass() ~= "weapon_bugbait") then
|
||||
return
|
||||
end
|
||||
|
||||
ply.nospamtime = CurTime()
|
||||
|
||||
local snd = sounds[math.random(1, #sounds)]
|
||||
ply:EmitSound(snd.path .. math.random(1, snd.range) .. ".wav", 100, 100)
|
||||
end
|
||||
concommand.Add("_hobo_emitsound", MakeZombieSoundsAsHobo)
|
||||
Reference in New Issue
Block a user