Is there a way to have scripts do something on restart or stop? Redm/CFX/LUA

--------------------------------------------------
-- Cleanup ---------------------------------------
-- Always leave a space cleaner than you found it.
-------------------------------------------------- 
AddEventHandler('onResourceStop', function(resource) 
	if resource == GetCurrentResourceName() then   
		ClearPedTasksImmediately(PlayerPedId())
        --- do something on startup
	end
end)
Dragon Codes