Skip to content

Instantly share code, notes, and snippets.

@rchanou
Created March 17, 2021 03:52
Show Gist options
  • Save rchanou/bc3b0cc308baab65e4ed52d55e00c47d to your computer and use it in GitHub Desktop.
Save rchanou/bc3b0cc308baab65e4ed52d55e00c47d to your computer and use it in GitHub Desktop.
local stateFirstLoad = true
local stateToolHeld = false
function RunResinRadar()
if stateFirstLoad then
stateFirstLoad = false
print("Initializing Resin Detector.")
ListenToGameEvent("weapon_switch", OnSwitch, itemTable)
local mTool = Entities:FindByClassname(nil, "hlvr_multitool")
stateToolHeld = IsValidEntity(mTool)
end
if stateToolHeld then
EmitResinSound()
end
end
function OnSwitch(itemTable)
stateToolHeld = itemTable["item"] == "hlvr_multitool"
end
function EmitResinSound()
local res = Entities:FindAllByClassname("item_hlvr_crafting_currency_small")
for k,v in pairs(res) do
EmitSoundOn("HackingPuzzle.TripminePulse", v)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment