Add canchat permission as well as godmode being a toggle command.
This commit is contained in:
parent
4e9698b6ee
commit
ce73b0c0b5
6 changed files with 71 additions and 16 deletions
|
|
@ -231,6 +231,7 @@ namespace TShockAPI
|
|||
add(Permissions.whisper, Reply, "reply", "r");
|
||||
add(Permissions.annoy, Annoy, "annoy");
|
||||
add(Permissions.kill, Kill, "kill");
|
||||
add(Permissions.godmode, ToggleGodMode, "godmode");
|
||||
add(Permissions.butcher, Butcher, "butcher");
|
||||
add(Permissions.item, Give, "give", "g");
|
||||
add(Permissions.clearitems, ClearItems, "clear", "clearitems");
|
||||
|
|
@ -3922,6 +3923,41 @@ namespace TShockAPI
|
|||
args.Player.SendSuccessMessage("Tried to grow a " + name + ".");
|
||||
}
|
||||
|
||||
private static void ToggleGodMode(CommandArgs args)
|
||||
{
|
||||
TSPlayer playerToGod;
|
||||
if (args.Parameters.Count > 0)
|
||||
{
|
||||
string plStr = String.Join(" ", args.Parameters);
|
||||
var players = TShock.Utils.FindPlayer(plStr);
|
||||
if (players.Count == 0)
|
||||
{
|
||||
args.Player.SendErrorMessage("Invalid player!");
|
||||
return;
|
||||
}
|
||||
else if (players.Count > 1)
|
||||
{
|
||||
TShock.Utils.SendMultipleMatchError(args.Player, players.Select(p => p.Name));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
playerToGod = players[0];
|
||||
}
|
||||
}
|
||||
else if (!args.Player.RealPlayer)
|
||||
{
|
||||
args.Player.SendErrorMessage("You cant god mode a non player!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
playerToGod = args.Player;
|
||||
}
|
||||
|
||||
playerToGod.GodMode = !playerToGod.GodMode;
|
||||
}
|
||||
|
||||
#endregion Cheat Comamnds
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,6 +270,7 @@ namespace TShockAPI
|
|||
[Description("The number of reserved slots past your max server slot that can be joined by reserved players")] public int ReservedSlots = 20;
|
||||
|
||||
[Description("The number of reserved slots past your max server slot that can be joined by reserved players")] public bool LogRest = false;
|
||||
|
||||
/// <summary>
|
||||
/// Reads a configuration file from a given path
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1322,7 +1322,7 @@ namespace TShockAPI
|
|||
args.Player.PlayerData.maxHealth = max;
|
||||
}
|
||||
|
||||
if (args.Player.Group.HasPermission(Permissions.godmode) && (cur < max))
|
||||
if (args.Player.GodMode && (cur < max))
|
||||
{
|
||||
args.Player.Heal(args.TPlayer.statLifeMax);
|
||||
}
|
||||
|
|
@ -2937,7 +2937,7 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
if (args.Player.Group.HasPermission(Permissions.godmode))
|
||||
if (args.Player.GodMode)
|
||||
{
|
||||
args.Player.Heal(args.TPlayer.statLifeMax);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -286,6 +286,9 @@ namespace TShockAPI
|
|||
[Description("Player recovers health as damage is taken. Can be one shotted.")]
|
||||
public static readonly string godmode = "tshock.godmode";
|
||||
|
||||
[Description("Player can chat")]
|
||||
public static readonly string canchat = "tshock.canchat";
|
||||
|
||||
/// <summary>
|
||||
/// Lists all commands associated with a given permission
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -282,6 +282,11 @@ namespace TShockAPI
|
|||
/// </summary>
|
||||
public bool LoginHarassed = false;
|
||||
|
||||
/// <summary>
|
||||
/// Player cant die, unless onehit
|
||||
/// </summary>
|
||||
public bool GodMode = false;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the player is a real, human, player on the server.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -914,15 +914,10 @@ namespace TShockAPI
|
|||
Log.Error(ex.ToString());
|
||||
}
|
||||
}
|
||||
else if (!tsplr.mute && !TShock.Config.EnableChatAboveHeads)
|
||||
else
|
||||
{
|
||||
Utils.Broadcast(
|
||||
String.Format(Config.ChatFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix, args.Text),
|
||||
tsplr.Group.R, tsplr.Group.G, tsplr.Group.B);
|
||||
args.Handled = true;
|
||||
} else if (!tsplr.mute && TShock.Config.EnableChatAboveHeads)
|
||||
if (!tsplr.Group.HasPermission(Permissions.canchat))
|
||||
{
|
||||
Utils.Broadcast(args.Who, String.Format(Config.ChatAboveHeadsFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix, args.Text), tsplr.Group.R, tsplr.Group.G, tsplr.Group.B);
|
||||
args.Handled = true;
|
||||
}
|
||||
else if (tsplr.mute)
|
||||
|
|
@ -930,6 +925,21 @@ namespace TShockAPI
|
|||
tsplr.SendErrorMessage("You are muted!");
|
||||
args.Handled = true;
|
||||
}
|
||||
else if (!TShock.Config.EnableChatAboveHeads)
|
||||
{
|
||||
Utils.Broadcast(
|
||||
String.Format(Config.ChatFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix, args.Text),
|
||||
tsplr.Group.R, tsplr.Group.G, tsplr.Group.B);
|
||||
args.Handled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.Broadcast(args.Who,
|
||||
String.Format(Config.ChatAboveHeadsFormat, tsplr.Group.Name, tsplr.Group.Prefix, tsplr.Name, tsplr.Group.Suffix,
|
||||
args.Text), tsplr.Group.R, tsplr.Group.G, tsplr.Group.B);
|
||||
args.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue