#This is a part of a game plugin
def On_EntityHurt(self, HurtEvent):
if HurtEvent.Attacker is not None and HurtEvent.Entity is not None and not HurtEvent.IsDecay
and HurtEvent.AttackerIsPlayer:
id = HurtEvent.Attacker.SteamID
if DataStore.ContainsKey("HomeHit", id):
HurtEvent.DamageAmount = 0
name = DataStore.Get("HomeHit", id)
if "Ceiling" in HurtEvent.Entity.Name or "Foundation" in HurtEvent.Entity.Name:
if self.FriendOf(HurtEvent.Entity.OwnerID, id):
DataStore.Remove("HomeHit", id)
vec = Util.CreateVector(float(HurtEvent.Entity.X), float(HurtEvent.Entity.Y) + 5.7,
float(HurtEvent.Entity.Z))
self.SaveHome(HurtEvent.Attacker, name, vec)
else:
HurtEvent.Attacker.MessageFrom(self.homesystemname, red
+ "You are not whitelisted for this foundation!")
else:
HurtEvent.Attacker.MessageFrom(self.homesystemname, red
+ "Hit a foundation/ceiling to save your home!")
#Error after trigger :
[Error] Failed to invoke: HomeSystem.On_EntityHurt()
argument of type ‘NoneType’ is not iterable
Int32 Run(Microsoft.Scripting.Interpreter.InterpretedFrame)
at (wrapper dynamic-method) object.CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object,object) <0x0009b>
at Microsoft.Scripting.Interpreter.DynamicInstruction`3<object, object, bool>.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) <0x000a7>
at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame) <0x00082>
Traceback (most recent call last):
File “HomeSystem”, line 703, in On_EntityHurt
TypeError: argument of type ‘NoneType’ is not iterable
Havent tried anything i’m not a programmer just wanted a fix for this
Amirreza Ansari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.