Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Config
- -- command to execute
- reset_command = "sv_map_reset"
- -- in seconds, the amount of time to elapse for an empty server to reset
- time_to_reset = 15
- --End of config
- api_version = "1.9.0.0"
- CURRENT_PLAYER_COUNT_ADDRESS = nil
- TIME_ELAPSED = 0
- function OnScriptLoad()
- local player_header_pointer = sig_scan("A1??????008B503453558B6C241C8BCD5681E1") + 0x1
- local player_header = read_dword(read_dword(player_header_pointer))
- CURRENT_PLAYER_COUNT_ADDRESS = player_header + 0x2E
- time_to_reset = time_to_reset * 30
- register_callback(cb['EVENT_TICK'], "OnTick")
- end
- function OnTick()
- if(read_word(CURRENT_PLAYER_COUNT_ADDRESS) == 0) then
- TIME_ELAPSED = TIME_ELAPSED + 1
- elseif(TIME_ELAPSED ~= 0) then
- TIME_ELAPSED = 0
- end
- if(TIME_ELAPSED >= time_to_reset) then
- execute_command_sequence(reset_command)
- TIME_ELAPSED = 0
- end
- end
- function OnScriptUnload() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement