All commands now working from console (some print message that they can't be performed from console)

PlayerDamage accept TSPlayer
Added property to check if TSPlayer is real and if connection for that player is alive
This commit is contained in:
ricky 2011-06-16 13:18:48 +10:00
parent 9ed47768ad
commit f84949affa
4 changed files with 419 additions and 370 deletions

View file

@ -294,7 +294,7 @@ namespace TShockAPI
private void GetData(GetDataEventArgs e)
{
if (!Netplay.serverSock[e.Msg.whoAmI].active || Netplay.serverSock[e.Msg.whoAmI].kill)
if (!Players[e.Msg.whoAmI].ConnectionAlive)
return;
if (Main.verboseNetplay)
@ -935,9 +935,9 @@ namespace TShockAPI
}
}
public static void PlayerDamage(int plr, int damage)
public static void PlayerDamage(TSPlayer player, int damage)
{
NetMessage.SendData(26, -1, -1, "", plr, ((new Random()).Next(-1, 1)), damage, (float)0);
NetMessage.SendData(26, -1, -1, "", player.Index, ((new Random()).Next(-1, 1)), damage, (float)0);
}
//TODO : Notify the player if there is more than one match. (or do we want a First() kinda thing?)