Koenrad

Untitled

Nov 3rd, 2014
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.78 KB | None | 0 0
  1. __author__ = 'DreTaX'
  2. __version__ = '1.5'
  3.  
  4. import clr
  5.  
  6. clr.AddReferenceByPartialName("Pluton")
  7. import Pluton
  8. import math
  9. import System
  10. from System import *
  11.  
  12. """
  13. Class
  14. """
  15.  
  16.  
  17. class DeathMSG:
  18. BodyParts = {'2801294865': 'Head', '3847415609': 'Hand', '2881065196': 'Body', '3847102050': 'Legs', '2868606315': 'Foot'}
  19.  
  20. def DeathMSGConfig(self):
  21. if not Plugin.IniExists("DeathMSGConfig"):
  22. loc = Plugin.CreateIni("DeathMSGConfig")
  23. loc.AddSetting("Settings", "SysName", "Equinox DeathMSG")
  24. loc.AddSetting("Settings", "NaturalDies", "1")
  25. loc.AddSetting("Settings", "KillLog", "1")
  26. loc.AddSetting("Settings", "SuicideMsg", "victim suicided...")
  27. loc.AddSetting("Settings", "NaturalMsg", "victim died because of (a) type")
  28. loc.AddSetting("Settings", "FallMsg", "victim died because he fell off from something")
  29. loc.AddSetting("Settings", "BledMsg", "victim bled out. He was killed by: killer")
  30. loc.AddSetting("Settings", "BledMsg2", "victim bled out.")
  31. loc.AddSetting("Settings", "DrownedMsg", "victim Drowned")
  32. loc.AddSetting("Settings", "ColdMsg", "victim Caught Cold, and died.")
  33. loc.AddSetting("Settings", "XyzMsg", "victim suicided....")
  34. loc.AddSetting("Settings", "KillMessage", "victim was killed by killer | Damage: dmg | Distance: dist | With: weapon | Part: bodypart")
  35. loc.Save()
  36. return Plugin.GetIni("DeathMSGConfig")
  37.  
  38. def On_PluginInit(self):
  39. self.DeathMSGConfig()
  40.  
  41. def IsNatural(self, type):
  42. if type == "Bite" or type == "BluntTrauma" or type == "Heat" or type == "Hunger" or type == "Radiation" or type == "Thirst":
  43. return True
  44. return False
  45.  
  46. def On_PlayerDied(self, PlayerDeathEvent):
  47. if PlayerDeathEvent.Attacker.ToPlayer() is None:
  48. return
  49.  
  50. attacker = PlayerDeathEvent.Attacker
  51. victim = PlayerDeathEvent.Victim
  52. attackername = str(attacker.displayName)
  53. victimname = str(victim.Name)
  54. if attackername == victimname:
  55. ini = self.DeathMSGConfig()
  56. NaturalDies = ini.GetSetting("Settings", "NaturalDies")
  57. sysname = ini.GetSetting("Settings", "SysName")
  58. if int(NaturalDies) == 1:
  59. type = str(PlayerDeathEvent.DamageType)
  60. if self.IsNatural(type):
  61. ntrmsg = ini.GetSetting("Settings", "NaturalMsg")
  62. ntrmsg = ntrmsg.replace("victim", victimname)
  63. ntrmsg = ntrmsg.replace("type", type)
  64. Server.BroadcastFrom(sysname, ntrmsg)
  65. elif type == "Generic":
  66. cmsg = ini.GetSetting("Settings", "XyzMsg")
  67. cmsg = cmsg.replace("victim", victimname)
  68. Server.BroadcastFrom(sysname, cmsg)
  69. elif type == "Suicide":
  70. smsg = ini.GetSetting("Settings", "SuicideMsg")
  71. smsg = smsg.replace("victim", victimname)
  72. Server.BroadcastFrom(sysname, smsg)
  73. elif type == "Fall":
  74. fmsg = ini.GetSetting("Settings", "FallMsg")
  75. fmsg = fmsg.replace("victim", victimname)
  76. Server.BroadcastFrom(sysname, fmsg)
  77. elif type == "Drowned":
  78. dmsg = ini.GetSetting("Settings", "DrownedMsg")
  79. dmsg = dmsg.replace("victim", victimname)
  80. Server.BroadcastFrom(sysname, dmsg)
  81. elif type == "Cold":
  82. cmsg = ini.GetSetting("Settings", "ColdMsg")
  83. cmsg = cmsg.replace("victim", victimname)
  84. Server.BroadcastFrom(sysname, cmsg)
  85. elif type == "Bleeding":
  86. bmsg = ini.GetSetting("Settings", "BledMsg2")
  87. bmsg = bmsg.replace("victim", victimname)
  88. Server.BroadcastFrom(sysname, bmsg)
  89. elif attackername != victimname:
  90. ini = self.DeathMSGConfig()
  91. sysname = ini.GetSetting("Settings", "SysName")
  92. dmgmsg = ini.GetSetting("Settings", "KillMessage")
  93. type = str(PlayerDeathEvent.DamageType)
  94. weapon = str(PlayerDeathEvent._info.Weapon.info.displayname)
  95. if type == "Bullet" or type == "Slash":
  96. if type == "Bullet":
  97. bodypart = str(PlayerDeathEvent._info.HitPart)
  98. else:
  99. bodypart = "Body"
  100. vloc = victim.Location
  101. aloc = attacker.transform.position
  102. dist = round(Util.GetVectorsDistance(vloc, aloc), 2)
  103. damage = PlayerDeathEvent.DamageAmount
  104. dmgmsg = dmgmsg.replace("killer", attackername)
  105. dmgmsg = dmgmsg.replace("victim", victimname)
  106. dmgmsg = dmgmsg.replace("dmg", str(damage))
  107. dmgmsg = dmgmsg.replace("dist", str(dist))
  108. dmgmsg = dmgmsg.replace("weapon", weapon)
  109. try:
  110. dmgmsg = dmgmsg.replace("bodypart", self.BodyParts[bodypart])
  111. except KeyError:
  112. dmgmsg = dmgmsg.replace("bodypart", "unknown")
  113. KillLog = ini.GetSetting("Settings", "KillLog")
  114. Server.BroadcastFrom(sysname, dmgmsg)
  115. if int(KillLog) == 1:
  116. Plugin.Log("KillLog", str(System.DateTime.Now) + " " + dmgmsg)
  117. elif type == "Bleeding":
  118. bmsg = ini.GetSetting("Settings", "BledMsg")
  119. bmsg = bmsg.replace("victim", victimname)
  120. bmsg = bmsg.replace("killer", attackername)
  121. Server.BroadcastFrom(sysname, bmsg)
Advertisement
Add Comment
Please, Sign In to add comment