mirror of https://github.com/bmgjet/Downed.git
Add files via upload
This commit is contained in:
parent
2878c7db4b
commit
c37a23316c
56
Downed.cs
56
Downed.cs
|
@ -6,7 +6,7 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Oxide.Plugins
|
namespace Oxide.Plugins
|
||||||
{
|
{
|
||||||
[Info("Downed", "bmgjet", "1.0.2")]
|
[Info("Downed", "bmgjet", "1.0.3")]
|
||||||
[Description("Extends knocked down timer and give cui to player. Allow NPC Knock Downs")]
|
[Description("Extends knocked down timer and give cui to player. Allow NPC Knock Downs")]
|
||||||
|
|
||||||
class Downed : RustPlugin
|
class Downed : RustPlugin
|
||||||
|
@ -49,7 +49,7 @@ namespace Oxide.Plugins
|
||||||
IgnoreScarecrow = false,
|
IgnoreScarecrow = false,
|
||||||
IgnoreMurderer = false,
|
IgnoreMurderer = false,
|
||||||
NPCIgnoreDowned = false,
|
NPCIgnoreDowned = false,
|
||||||
SFX = new string[]{"https://github.com/bmgjet/Stations/raw/main/Help.Me.mp3", "https://github.com/bmgjet/Downed/raw/main/Help.Me.mp3" },
|
SFX = new string[] { "https://github.com/bmgjet/Stations/raw/main/Help.Me.mp3", "https://github.com/bmgjet/Downed/raw/main/Help.Me.mp3" },
|
||||||
SFXPlayTime = 10,
|
SFXPlayTime = 10,
|
||||||
SFXNPC = false,
|
SFXNPC = false,
|
||||||
SFXPLAYER = false
|
SFXPLAYER = false
|
||||||
|
@ -110,7 +110,7 @@ namespace Oxide.Plugins
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
private object OnNpcTarget(NPCPlayerApex npc, BaseEntity entity)
|
private object OnNpcTarget(NPCPlayer npc, BaseEntity entity)
|
||||||
{
|
{
|
||||||
if (entity == null || npc == null) return null;
|
if (entity == null || npc == null) return null;
|
||||||
if (npc.IsWounded() || npc.IsIncapacitated())
|
if (npc.IsWounded() || npc.IsIncapacitated())
|
||||||
|
@ -156,16 +156,13 @@ namespace Oxide.Plugins
|
||||||
//Creates a timer to switches to crawl
|
//Creates a timer to switches to crawl
|
||||||
downedPlayers.Add(player.userID, timer.Once(config.UIDelay, () =>
|
downedPlayers.Add(player.userID, timer.Once(config.UIDelay, () =>
|
||||||
{
|
{
|
||||||
try{
|
if (player != null && !player.IsDead())
|
||||||
if (!player.IsDead())
|
|
||||||
{
|
{
|
||||||
player.StopWounded(); //Reset the wounded state
|
player.StopWounded(); //Reset the wounded state
|
||||||
downedPlayers[player.userID] = null; //Clear this timer
|
downedPlayers[player.userID] = null; //Clear this timer
|
||||||
LongDown(player); //Custom wounded state with cui
|
LongDown(player); //Custom wounded state with cui
|
||||||
player.SendNetworkUpdateImmediate();
|
player.SendNetworkUpdateImmediate();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch{}
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
return null; //Normal operation.
|
return null; //Normal operation.
|
||||||
|
@ -209,10 +206,18 @@ namespace Oxide.Plugins
|
||||||
if (currentgun != null)
|
if (currentgun != null)
|
||||||
{
|
{
|
||||||
currentgun.primaryMagazine.contents = 0;
|
currentgun.primaryMagazine.contents = 0;
|
||||||
timer.Repeat(1.8f, config.NPCDownTimer, () =>
|
var reloadloop = timer.Repeat(1.8f, config.NPCDownTimer, () =>
|
||||||
{
|
{
|
||||||
currentgun.primaryMagazine.contents = 0; //Keep unloading so cant shoot.
|
currentgun.primaryMagazine.contents = 0; //Keep unloading so cant shoot.
|
||||||
});
|
});
|
||||||
|
timer.Once(config.NPCDownTimer + 5f, () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
reloadloop.Destroy();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
timer.Once(config.NPCDownTimer, () =>
|
timer.Once(config.NPCDownTimer, () =>
|
||||||
|
@ -294,7 +299,8 @@ namespace Oxide.Plugins
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sph?.Kill();
|
if (sph != null)
|
||||||
|
sph?.Kill();
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
});
|
});
|
||||||
|
@ -365,23 +371,35 @@ namespace Oxide.Plugins
|
||||||
//Start Countdown timer
|
//Start Countdown timer
|
||||||
var countdowntimer = timer.Repeat(1, config.Countdown + 1, () =>
|
var countdowntimer = timer.Repeat(1, config.Countdown + 1, () =>
|
||||||
{
|
{
|
||||||
if (!player.IsDead() && downedPlayers.ContainsKey(player.userID))
|
try
|
||||||
{
|
{
|
||||||
GetUpTimer(player, "<color=red>Get UP IN</color> " + (config.Countdown - i).ToString());
|
if (!player.IsDead() && downedPlayers.ContainsKey(player.userID))
|
||||||
if (i++ >= config.Countdown)
|
{
|
||||||
|
GetUpTimer(player, "<color=red>Get UP IN</color> " + (config.Countdown - i).ToString());
|
||||||
|
if (i++ >= config.Countdown)
|
||||||
|
{
|
||||||
|
cuidestroy(player);
|
||||||
|
LongDown(player, false);
|
||||||
|
removedowned(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
cuidestroy(player);
|
|
||||||
LongDown(player, false);
|
|
||||||
removedowned(player);
|
removedowned(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
catch { }
|
||||||
{
|
|
||||||
removedowned(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
timer.Once(config.Countdown + 5f, () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
countdowntimer.Destroy();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
});
|
||||||
if (downedPlayers.ContainsKey(player.userID))
|
if (downedPlayers.ContainsKey(player.userID))
|
||||||
{
|
{
|
||||||
downedPlayers.Remove(player.userID);
|
downedPlayers.Remove(player.userID);
|
||||||
|
|
Loading…
Reference in New Issue