[FSOD] /spawnon
Despite how inactive I've been on MPGH, I suppose I'll contribute again
Creds to @OmegaBM for helping me out especially when I stopped developing for a year and quit pservers
Things been sitting in my admin commands collecting dust, cheers fellas
If you have any questions, read my signature and make your move, skypes trash anyways
- - - Updated - - -
Also don't forget to change
to the rank integer that you want assigned to
Creds to @OmegaBM for helping me out especially when I stopped developing for a year and quit pservers
Things been sitting in my admin commands collecting dust, cheers fellas
Code:
internal class SpawnOnCommand : Command {
public SpawnOnCommand()
: base("spawnon", 6)
{
}
protected override bool Process(Player player, RealmTime time, string[] args)
{
if (string.IsNullOrEmpty(args[0]))
{
player.SendHelp("Usage: /spawnon <Player> <Int> <Entity>");
return false;
}
foreach (Client i in player.Manager.Clients.Values)
{
if (i.Account.Name.EqualsIgnoreCase(args[0]))
{
int num;
if (args[1].Length > 0 && int.TryParse(args[1], out num)) //multi
{
string name = string.Join(" ", args.Skip(2).ToArray());
ushort objType;
Dictionary<string, ushort> icdatas = new Dictionary<string, ushort>(
player.Manager.GameData.IdToObjectType,
StringComparer.OrdinalIgnoreCase);
if (!icdatas.TryGetValue(name, out objType) ||
!player.Manager.GameData.ObjectDescs.ContainsKey(objType))
{
player.SendInfo("Unknown entity!");
return false;
}
else
{
for (int u = 0; u < num; u++)
{
Entity entity = Entity.Resolve(player.Manager, objType);
entity.Move(i.Player.X, i.Player.Y);
i.Player.Owner.EnterWorld(entity);
}
player.SendInfo("Sent " + i.Player.Name + " " + string.Join(" ", args.Skip(1).ToArray()) + "'s");
return true;
}
}
}
else
{
if (i.Account.Name.EqualsIgnoreCase(args[0]))
{
{
string name = string.Join(" ", args.Skip(1).ToArray());
ushort objType;
Dictionary<string, ushort> icdatas = new Dictionary<string, ushort>(
player.Manager.GameData.IdToObjectType,
StringComparer.OrdinalIgnoreCase);
if (!icdatas.TryGetValue(name, out objType) ||
!player.Manager.GameData.ObjectDescs.ContainsKey(objType))
{ }
Entity entity = Entity.Resolve(player.Manager, objType);
entity.Move(i.Player.X, i.Player.Y);
i.Player.Owner.EnterWorld(entity);
}
player.SendInfo("Sent " + i.Player.Name + " " + string.Join(" ", args.Skip(1).ToArray()));
return true;
}
}
}
return false;
}
}
Known Bugs
You can fix this yourself as I am too lazy to do it
- When you do /spawnon <player> <entity>
it will not tell you that you forgot to add an integer between the player and entity
(I believe I attempted to fix it a while ago when I first made this, it's probably incomplete or incorrect)
- When you do /spawnon <player> <entity>
it will not tell you that you forgot to add an integer between the player and entity
(I believe I attempted to fix it a while ago when I first made this, it's probably incomplete or incorrect)
If you have any questions, read my signature and make your move, skypes trash anyways
- - - Updated - - -
Also don't forget to change
to the rank integer that you want assigned to
