__author__ = 'Ferum'
__version__ = '1.0'
import clr
clr.AddReferenceByPartialName("Fougerite")
import Fougerite
class HackTest:
def isMod(self, id):
if DataStore.ContainsKey("Moderators", id):
return True
return False
"""
CheckV method based on Spock's method.
Upgraded by DreTaX
Can Handle Single argument and Array args.
V4.1
"""
def GetPlayerName(self, namee):
try:
name = namee.lower()
for pl in Server.Players:
if pl.Name.lower() == name:
return pl
return None
except:
return None
def CheckV(self, Player, args):
count = 0
if hasattr(args, '__len__') and (not isinstance(args, str)):
p = self.GetPlayerName(str.join(" ", args))
if p is not None:
return p
for pl in Server.Players:
for namePart in args:
if namePart.lower() in pl.Name.lower():
p = pl
count += 1
continue
else:
nargs = str(args).lower()
p = self.GetPlayerName(nargs)
if p is not None:
return p
for pl in Server.Players:
if nargs in pl.Name.lower():
p = pl
count += 1
continue
if count == 0:
if Player is not None:
Player.MessageFrom("HackTest", "Couldn't find [color#00FF00]" + str.join(" ", args) + "[/color]!")
return None
elif count == 1 and p is not None:
return p
else:
if Player is not None:
Player.MessageFrom("HackTest", "Found [color#FF0000]" + str(count) +
"[/color] player with similar name. [color#FF0000] Use more correct name!")
return None
def On_Command(self, Player, cmd, args):
if cmd == "hacktest":
if Player.Admin or self.isMod(Player.SteamID):
if len(args) > 0:
pl = self.CheckV(Player, args)
if pl is None:
return
Player.Message("Launching test on: " + pl.Name)
pl.TeleportTo(pl.X, pl.Y + 25.0, pl.Z)
List = Plugin.CreateDict()
List["Health"] = pl.Health
List["Player"] = pl
List["Executor"] = Player
Plugin.CreateParallelTimer("hack", 3000, List).Start()
else:
Player.Message("Usage: /hacktest playername")
def hackCallback(self, timer):
timer.Kill()
List = timer.Args
if List["Health"] > List["Player"].Health:
List["Executor"].Notice("Test was successful")
else:
List["Executor"].Notice(List["Player"].Name + " failed the drop test.")