# UpSync Plugin Autoupdater! # created by isivisi # # To add UpSync to your addon just place upsync.py in YOURADDON/upsync/. # after that your going to have to set some variables in upsync.py so it knows what it update # set addonName to the addons directory name in eventscript/ ex. eventscripts/lol would be 'lol' # set addonESDM to the addons esdm name ex. http://addons.eventscripts.com/addons/view/deathrunv2 would be 'deathrunv2' # you can keep autoUpdateOnMapStart to true if you want it to automaticly synchronize when the map changes. # if you dont set autoUpdateOnMapStart to true you should somewere add es.server.queuecmd('YOUR UPDATE CMD') to update your plugin! # REMEMBER YOU CAN ONLY USE UPSYNC WITH ES_INSTALL PLUGINS (APPROVED AND HAVE BEEN INSTALLED WITH ES_INSTALL) import es, installlib, gamethread # configurations addonName = 'addonName' addonESDM = 'addonEventscriptsDownloadManagerName' addonUpdateCmd = 'updatemyprogram' # make it unique! autoUpdateOnMapStart = True # Begin pathToUpSync = '%s/upsync' % addonName def say(msg): es.msg('[UpSync] %s' % msg) def load(): es.set('UpSync_version', '1.0') es.set('UpSync_updatefor', addonName) es.makepublic('UpSync_version') es.makepublic('UpSync_updatefor') cmdBlock = '%s/update' % pathToUpSync es.regcmd(addonUpdateCmd, cmdBlock, 'command to update %s'%(addonName)) def update(): try: update = installlib.getInstaller(addonESDM) update.update(False) gamethread.delayed(10, reload, addonName) say('%s has been synchronized' % addonName) except: say('%s failed to synchronize with ESDM' % addonName) def reload(plugin): es.load(plugin) def es_map_start(ev): if autoUpdateOnMapStart == True: es.server.queuecmd(addonUpdateCmd)