Skip to content

Instantly share code, notes, and snippets.

@JJL772
Created April 3, 2020 01:47
Show Gist options
  • Save JJL772/2b81484dcf36ea5974af8c48b4d3bcb1 to your computer and use it in GitHub Desktop.
Save JJL772/2b81484dcf36ea5974af8c48b4d3bcb1 to your computer and use it in GitHub Desktop.
example script thingy
-- Stop listening to the events if we're already listening to them (this is so we can safely reload the script)
if onplayershoot_handle == nil then
StopListeningToGameEvent(onplayershoot_handle)
StopListeningToGameEvent(onplayerhurt_handle) -- we can assume this is valid too since they're added at the same time
end
function OnPlayerHurt(dmginfo)
Msg("Player has been hurt")
end
function OnPlayerShoot(evinfo)
Msg("Player has shot their weapon")
end
-- Register the handlers and set the global handles
onplayershoot_handle = ListenToGameEvent("player_shoot", OnPlayerShoot, nil)
onplayerhurt_handle = ListenToGameEvent("player_hurt", OnPlayerHurt, nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment