Created
April 3, 2020 01:47
-
-
Save JJL772/2b81484dcf36ea5974af8c48b4d3bcb1 to your computer and use it in GitHub Desktop.
example script thingy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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