Skip to content

Commit

Permalink
Fixed First Connection Message
Browse files Browse the repository at this point in the history
- Fixed "Notify player on first connection with protection time"
- Fixed Use Game Tips. Now if enabled it wont also send it chat.
- Added Better Discription to Player Data in the config file.
  • Loading branch information
jkole4 authored Jun 26, 2021
1 parent f7d34ab commit 03cc60e
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions AntiNoobRaid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Oxide.Plugins
{
[Info("AntiNoobRaid", "Slydelix & RustySpoon", "1.9.0", ResourceId = 2697)]
[Info("AntiNoobRaid", "Slydelix & RustySpoon", "1.9.1", ResourceId = 2697)]
class AntiNoobRaid : RustPlugin
{
[PluginReference] private Plugin PlaytimeTracker, WipeProtection, GameTipAPI, Clans;
Expand Down Expand Up @@ -61,7 +61,7 @@ private class ConfigFile
public bool KillFire;
[JsonProperty("List of entities that can be destroyed even if owner is a noob, true = destroyable everywhere (not inside of owners TC range)")]
public Dictionary<string, bool> AllowedEntities = PlaceHolderDictionary;
[JsonProperty("Player Data")]
[JsonProperty("Player Data (leave it false. if you change it you will tell the plugin to not save player data)")]
public bool playerdata;
[JsonProperty("Notify player on first connection with protection time")]
public bool MessageOnFirstConnection;
Expand Down Expand Up @@ -124,6 +124,7 @@ private class ConfigFile
AllowedEntities = PlaceHolderDictionary,
CheckTeamForOwner = true,
RemoveTeamProtection = true,
playerdata = false,
//AutoAddProtection = true,
//AutoMinutes = 60
};
Expand Down Expand Up @@ -785,7 +786,7 @@ private void CheckPlayersWithNoInfo()
});
}

private void FirstMessage(BasePlayer player)
private void OnPlayerConnected(BasePlayer player)
{
if (!config.MessageOnFirstConnection || storedData.FirstMessaged.Contains(player.userID)) return;
storedData.FirstMessaged.Add(player.userID);
Expand All @@ -795,18 +796,23 @@ private void FirstMessage(BasePlayer player)

string msg = string.Format(lang.GetMessage("firstconnectionmessage", this, player.UserIDString), (config.ProtectionTime / 3600d));

if (config.UseGT && GameTipAPI != null)
if (config.UseGT)
{
GameTipAPI?.Call("ShowGameTip", player, msg, 10f, true);
if (config.UseGT && GameTipAPI != null)
{
GameTipAPI?.Call("ShowGameTip", player, msg, 10f, true);
}
else
{
player.SendConsoleCommand("gametip.showgametip", msg);
timer.Once(10f, () => player.SendConsoleCommand("gametip.hidegametip"));
}
}

else
{
player.SendConsoleCommand("gametip.showgametip", msg);
timer.Once(10f, () => player.SendConsoleCommand("gametip.hidegametip"));
SendReply(player, msg);
}

SendReply(player, msg);
}

private ulong FullOwner(BaseEntity ent, BasePlayer p = null)
Expand Down

0 comments on commit 03cc60e

Please sign in to comment.