dryfly21 wrote:hello i need some help.
see using p.Kick(p.PublicName + "message"); says they got kicked and i dont want the globalmessage to say kicked in it.
using p.Disconnect(); worked but instead of being able to put a message in like p.Kick i had to set a global message underneath it and it said player disconnected.
i would like to know the method to have a custom leave message and kicks them
this is what i have and i dont like it.
- Code: Select all
p.Disconnect();
Player.GlobalMessage(p.color + "[" + p.title + "]" + p.PublicName + Server.DefaultColor + " Has said goodbye to their friends and left");
The 'Kick' method leads to a 'leftGame' method which can take a string parameter. If this string is empty ("") then the player is disconnected with a message of "disconnected". Otherwise, they are kicked with the message "kicked " + the string parameter. As the "kicked" part is found within the method itself, you cannot change this unfortunately.
However you could create your own method to kick a player, which would involve you sending the kick message as a packet to the player - and then closing their socket. However, there are many important factors involved when a player disconnects, such as removing them from appropriate lists and saving data. I do not know exactly what is involved in this process in MCDzienny so I cannot code a reliable custom method for you to kick players, which would be reliable.
The alternative way you're using now should be satisfactory enough (using a global message after correctly calling the Disconnect method), this is essentially all that happens in the leftGame/Kick method anyway - you're doing the same thing. The only downfall is that you will have the '-disconnected' message :/