public override bool Execute(IServerConnection server, IPlayer p, params string[] args) { if (!p.HomePosition.IsValid) { p.Message("R:Cmd.Home.NoHome"); return(false); } server.Execute("tele {0} {1}", p.EntityID, p.HomePosition.ToCommandString()); // HACK: Teleport fix? Thread.Sleep(2000); server.Execute("tele {0} {1}", p.EntityID, p.HomePosition.ToCommandString()); return(true); }
public override void Init(IServerConnection serverConnection, ILogger logger) { base.Init(serverConnection, logger); // Update LandProtections every 5 Minutes serverConnection.CalloutManager.AddCallout(this, this, new TimeSpan(0, 5, 0), true); serverConnection.Execute("llp"); }
public override bool Execute(IServerConnection server, IPlayer p, params string[] args) { // OK, so we want to execute this command on the most recent position of a player // Subscribe to the PositionUpdate. Note: This is a ONETIME event! p.PlayerPositionUpdated += p_PlayerPositionUpdated; // Now have the server execute the lp command to update the positions server.Execute("lp"); return(true); // Command Sucessfully executed, Deduct Costs and set Cooldowns }
public override bool ProcessLine(IServerConnection serverConnection, string currentLine) { if (rgDeath.IsMatch(currentLine)) { Match match = rgDeath.Match(currentLine); GroupCollection groups = match.Groups; IPlayer killer = serverConnection.AllPlayers.FindPlayerByNameOrID(groups["killer"].Value); IPlayer victim = serverConnection.AllPlayers.FindPlayerByNameOrID(groups["victim"].Value); if ((killer == null) || (victim == null)) { return(false); } if (killer == victim) { killer.AddCoins(-100, "Death"); killer.Message("You lost 100 coins."); } else { if (victim.Bounty != 0) { killer.CollectBounty(victim.Bounty, "Bounty on " + victim.Name); killer.Message("You collected the bounty of {0} coins set on {1}'s head.", victim.Bounty, victim.Name); victim.AddBounty((-1) * victim.Bounty, "collected by " + killer.Name); victim.Message("The bounty on your head has been cleared."); } else { if ((Program.Config.CoinPercentageOnKill > 0) && (victim.zCoins > 100)) { int howmuch = (int)((victim.zCoins * Program.Config.CoinPercentageOnKill) / 100.0); if (howmuch > 0) { killer.AddBloodCoins(howmuch, "Killed " + victim.Name); killer.Message("You took {0} coins from the dead body of {1}", howmuch, victim.Name); victim.AddCoins((-1) * howmuch, "Killed by " + killer.Name); victim.Message("{0} took {1} coins from your dead body.", killer.Name, howmuch); if (Program.Config.BountyFactor > 0) { killer.AddBounty((int)(howmuch * Program.Config.BountyFactor), "MDK " + victim.Name); } } } } } serverConnection.Execute("lp"); return(true); } return(false); }
public override bool ProcessLine(IServerConnection serverConnection, string currentLine) { if (rgPlayerJoin.IsMatch(currentLine)) { Match match = rgPlayerJoin.Match(currentLine); GroupCollection groups = match.Groups; IPlayer p = serverConnection.AllPlayers.AddPlayer(groups["name"].Value, groups["steamid"].Value, groups["entityid"].Value); p.Login(); serverConnection.Execute("lp"); return(true); } return(false); }
public override bool ProcessLine(IServerConnection serverConnection, string currentLine) { if (rgDeath.IsMatch(currentLine)) { Match match = rgDeath.Match(currentLine); GroupCollection groups = match.Groups; IPlayer p = serverConnection.AllPlayers.FindPlayerByNameOrID(groups["name"].Value); if (p != null) { p.AddCoins(-100, "Death"); p.Message("You lost 100 coins."); } serverConnection.Execute("lp"); return(true); } return(false); }
public bool CalloutCallback(ICallout c, IServerConnection serverConnection) { serverConnection.Execute(Command); return(false); }
public bool CalloutCallback(ICallout c, IServerConnection serverConnection) { serverConnection.Execute("llp"); return(true); }