Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cmd_restore(self, data, client, cmd=None):
- """\
- !restore - restores players rank
- """
- cursor2 = self.console.storage.query("""SELECT id, client_id, set_time, rankxp, score, kills, deaths, headshots, rank, ip FROM stats WHERE client_id = %s LIMIT 1"""%(client.id))
- input = self._adminPlugin.parseUserCmd(data)
- if cursor2.rowcount == 0:
- client.message("^7You have no stats to restore from!")
- return True
- if not input:
- while not cursor2.EOF:
- r2 = cursor2.getRow()
- if r2['ip'] != client.ip:
- client.message("^7Security check failed. Contact MiKeY or iMtroll on the forums to restore your rank.")
- return True
- else:
- client.message("^7Backup Restored: Date: %s, Backup ID: %s, Rank: %s, Score: %s" %( self.console.formatTime(r2['set_time']), r2['id'], r2['rank'],r2['score']))
- self.console.write('admin setstats:%s:%s.%s.%s.%s.%s.%s' % (client.cid,r2['rankxp'],r2['score'],r2['kills'],r2['deaths'],r2['headshots'],r2['rank'] ))
- return True
- cursor2.moveNext()
- else:
- client.message("An unknown error has occurred.")
- return False
- cursor2.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement