Resource icon

Approved FriendlyFireNotice 1.0

No permission to download

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
ice cold submitted a new resource:

FriendlyFireNotice - Shows an popup on the attacker his screen when he hits his friend



Read more about this resource...
You are slowing the code with the file reading.
Cache It.

Python:
import clr
clr.AddReferenceByPartialName("Fougerite")
import Fougerite

class FriendlyFireNotice:

    n = None

    def On_PluginInit(self):
        ini = self.Settings()
        self.n = ini.GetSetting("Popup", "Notice")

    def Settings(self):
        if not Plugin.IniExists("Settings"):
            ini = Plugin.CreateIni("Settings")
            ini.AddSetting("Popup", "Notice", "This is your friend")
            ini.Save()
        return Plugin.GetIni("Settings")


    def On_PlayerHurt(self, HurtEvent):
        if HurtEvent.AttackerIsPlayer and HurtEvent.VictimIsPlayer:
            list = Server.GetRustPPAPI().FriendsOf(HurtEvent.Attacker.UID)
            if list is not None:
                if list.isFriendWith(HurtEvent.Victim.UID):
                    HurtEvent.Attacker.Notice(self.n)
                    HurtEvent.DamageAmount = 0
 
  • Like
Reactions: ice cold