Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.04 KB | None | 0 0
  1. def banPlayer(this, playerName, banTime, reason, modName, silent):        
  2.         found = False
  3.        
  4.         player = this.players.get(playerName)
  5.         if player != None:
  6.             found = True
  7.             if not modName == "Server":
  8.                 player.banHours += banTime
  9.                 this.cursor.execute("insert into BanLog values (?, ?, ?, ?, ?, ?, 'Ban')", [playerName, modName, banTime, reason, str(time.time())[:len(str(time.time())) - 4], player.ipAddress])
  10.             else:
  11.                 this.sendStaffMessage(5, "<V>Servidor <BL>baniu o jogador <V>%s<BL> por <V>1 <BL> hora. Motivo: <V>Vote Populaire<BL>." %(playerName))
  12.  
  13.             this.cursor.execute("update Users SET BanHours = ? WHERE Username = ?", [banTime, playerName])
  14.  
  15.             if banTime >= 361 or player.banHours >= 361 and not player.isGuest:
  16.                 this.userPermaBanCache.append(playerName)
  17.                 this.cursor.execute("insert into UserPermaBan values (?)", [playerName])
  18.  
  19.                 this.ipPermaBanCache.append(player.ipAddress)
  20.                 this.cursor.execute("insert into IPPermaBan values (?)", [player.ipAddress])
  21.  
  22.             if banTime >= 1 and banTime <= 360 and not player.isGuest:
  23.                 this.userTempBanCache.append(playerName)
  24.                 this.cursor.execute("insert into usertempban values (?, ?, ?)", [playerName, Utils.getTime() + (banTime * 3600), reason])
  25.  
  26.             if not player.ipAddress in this.tempIPBanList:
  27.                 this.tempIPBanList.append(player.ipAddress)
  28.                 reactor.callLater(banTime, lambda: this.tempIPBanList.remove(player.ipAddress))
  29.  
  30.             if playerName in this.reports["names"]:
  31.                 this.reports[playerName]["status"] = "banned"
  32.                 this.reports[playerName]["status"] = "modName"
  33.                 this.reports[playerName]["status"] = str(banTime)
  34.                 this.reports[playerName]["banreason"] = "hack"
  35.  
  36.             player.sendPlayerBan(banTime, reason, silent)
  37.  
  38.         if not found and this.checkExistingAccount(playerName) and not modName == "Server" and banTime >= 1:
  39.             found = True
  40.             totalBanTime = this.getTotalBanHours(playerName) + banTime
  41.             if ((totalBanTime >= 361 and banTime <= 360) or banTime >= 361):
  42.                 this.userPermaBanCache.append(playerName)
  43.                 this.cursor.execute("insert into UserPermaBan values (?)", [playerName])
  44.  
  45.             if banTime >= 1 and banTime <= 360:
  46.                 this.userTempBanCache.append(playerName)
  47.                 this.cursor.execute("insert into UserTempBan values (?, ?, ?)", [playerName, str(Utils.getTime() + (banTime * 60 * 60)), reason])
  48.  
  49.             this.cursor.execute("update Users set BanHours = ? WHERE Username = ?", [banTime, playerName])
  50.             this.cursor.execute("insert into BanLog (Name, BannedBy, Time, Reason, Date, Status, Room, IP) values (?, ?, ?, ?, ?, ?, ?, ?)", [playerName, modName, str(banTime), reason, "Online", "Online", "Online", str(time.time())[:len(str(time.time())) - 4]])
  51.  
  52.         return found
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement