Fixed negative spawnrate
This commit is contained in:
parent
b9099757fb
commit
0a0d80c33e
1 changed files with 13 additions and 2 deletions
|
|
@ -2271,8 +2271,19 @@ namespace TShockAPI
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int amount = Convert.ToInt32(args.Parameters[0]);
|
int amount = -1;
|
||||||
int.TryParse(args.Parameters[0], out amount);
|
if (!int.TryParse(args.Parameters[0], out amount))
|
||||||
|
{
|
||||||
|
args.Player.SendWarningMessage(string.Format("Invalid spawnrate ({0})", args.Parameters[0]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amount < 0)
|
||||||
|
{
|
||||||
|
args.Player.SendWarningMessage("Spawnrate cannot be negative!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
NPC.defaultSpawnRate = amount;
|
NPC.defaultSpawnRate = amount;
|
||||||
TShock.Config.DefaultSpawnRate = amount;
|
TShock.Config.DefaultSpawnRate = amount;
|
||||||
TSPlayer.All.SendInfoMessage(string.Format("{0} changed the spawn rate to {1}.", args.Player.Name, amount));
|
TSPlayer.All.SendInfoMessage(string.Format("{0} changed the spawn rate to {1}.", args.Player.Name, amount));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue