-
Any reason why this code isn't working? When you do the command yourself it works
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
TSPlayer player = TShock.Players[args.Who];
player.Teleport(posX, posY, teleportStyle); would work Using the hook If you use the Command constructor with those arguments |
Beta Was this translation helpful? Give feedback.
-
Another question, if I were to do something similar in OnUpdate hook, how would I do it? |
Beta Was this translation helpful? Give feedback.
-
You can look at how tshock and other people's plugins do things for most books/interactions with the server and client If you want to see the data in eventArgs each hook has you can use intellisense or look at https://github.com/Pryaxis/TerrariaAPI-Server/tree/general-devel/TerrariaServerAPI/TerrariaApi.Server/EventArgs |
Beta Was this translation helpful? Give feedback.
TSPlayer.All
is a static readonly instance only for the sake of public broadcasts likeTSPlayer.All.SendInfoMessage("This is a public message.");
. Other methods do not work normally with this tsplayer object. TSPlayer constructer has the player index by default -1, and sendmessage will broadcast a message publicly if the player index is -1.https://github.com/Pryaxis/TShock/blob/general-devel/TShockAPI/TSPlayer.cs#L1430
The
TShock.All.Kick
in Utils.cs doesn't work either (not that it matters, you get disconnected and notified of the server shutdown anyways. Probably due to an api change of kick being moved from utils to tsplayer and mistakenly replacing utils.kickall with tsplayer.all.kick)