Apparently there is not a /lock & /unlock command according to @MikeRaarupBirk so here is the /lock command that is also a /unlock command(i should probably rename it but I am going to leave that to you gents)
I present to you /lock <playername>
usage :: /lock <playername>
(it will lock if the player is not lock and it will unlock if the player is locked)
example :: /lock TheFirstSin
(if you have not locked me it will lock me but if I am locked then it will unlock me)
Code ::
CODE
Code:
internal class Lock : Command
{
public Lock()
: base("lock", 1)
{
}
protected override boolProcess(Player player, RealmTime time, string[] args)
{
if (args.Length != 1)
{
player.SendHelp("Usage: /lock <playername>");
return false;
}
if (string.Equals(player.Name.ToLower(), args[0].ToLower()))
{
player.SendInfo("You are trying to lock yourself...Dumass.");
return false;
}
foreach (KeyValuePair<string, Client> i in player.Manager.Clients.Where (i => i.Value.Player.Name.EqualsIgnoreCase(args[0])))
{
foreach(string l in player.Locked)
{
Database db = new Database();
if (!l.Contains(i.Value.Account.AccountId))
{
db.AddLock(player.AccountId, i.Value.Account.AccountId);
player.Locked.Add(i.Value.Account.AccountId);
player.UpdateCount++;
return true;
}
db.RemoveLock(player.AccountId, i.Value.Account.AccountId);
player.Locked.Remove(i.Value.Account.AccountId);
player.UpdateCount++;
return true;
}
}
player.SendError($"Player {args[0]} could not be found");
return false;
}
}
if there is any questions or concerns PM me @</The First Sin/>
- - - Updated - - -
@Joe @Luis close, anyone wanting to speak with me just pm.