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

-- Is there a way to have scripts do something on restart or stop?
--------------------------------------------------
-- 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)  

By

Dragon Codes