Merge pull request #2447 from AgaSpace/patch-1
Add the ability to change the player's pvp mode
This commit is contained in:
parent
01aa4b5732
commit
f98df0e4a3
1 changed files with 12 additions and 0 deletions
|
|
@ -1562,6 +1562,18 @@ namespace TShockAPI
|
||||||
Main.player[Index].team = team;
|
Main.player[Index].team = team;
|
||||||
NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, -1, NetworkText.Empty, Index);
|
NetMessage.SendData((int)PacketTypes.PlayerTeam, -1, -1, NetworkText.Empty, Index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the player's pvp.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mode">The state of the pvp mode.</param>
|
||||||
|
public virtual void SetPvP(bool mode, bool withMsg = false)
|
||||||
|
{
|
||||||
|
Main.player[Index].hostile = mode;
|
||||||
|
NetMessage.SendData((int)PacketTypes.TogglePvp, -1, -1, NetworkText.Empty, Index);
|
||||||
|
if (withMsg)
|
||||||
|
TSPlayer.All.SendMessage(Language.GetTextValue(mode ? "LegacyMultiplayer.11" : "LegacyMultiplayer.12", Name), Main.teamColor[Team]);
|
||||||
|
}
|
||||||
|
|
||||||
private DateTime LastDisableNotification = DateTime.UtcNow;
|
private DateTime LastDisableNotification = DateTime.UtcNow;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue