Not sure if I did correct, but on the way I tried didn't worked.
class AdmMissionServer : MissionServer
{
override void OnEvent(EventType eventTypeId, Param params)
{
if (eventTypeId == ChatMessageEventTypeID)
{
ChatMessageEventParams chat_params = ChatMessageEventParams.Cast( params );
if (chat_params.param2 == "") return ;
PlayerBase player = GetPlayer(chat_params.param2);
if(player == NULL) return ;
string message = chat_params.param3, prefix, param0, command;
TStringArray tokens = new TStringArray;
message.Split(" ", tokens);
int count = tokens.Count();
param0 = tokens.Get(0);
param0.ParseStringEx(prefix);
if(prefix != "!") return ;
param0.ParseStringEx(command);
bool isValidCmd = true;
switch (command)
{
case "heal": { /*Do Heal function*/ break;}
case "tp": { /*Teleport function */ break;}
default :{
isValidCmd = false;
}
}
if (isValidCmd)
{
ChatMessageEventParams chat_params = ChatMessageEventParams.Cast(params);
Param new_params = new Param4<int, string, string, string>( chat_params.param1, chat_params.param2, "", chat_params.param4 );
super.OnEvent(eventTypeId, new_params);
}
else
{
super.OnEvent(eventTypeId, params);
}
}
else
{
super.OnEvent(eventTypeId, params);
}
}
}
Basically the change is this, here I tested make the user empty as well, but still see the messages around.
ChatMessageEventParams chat_params = ChatMessageEventParams.Cast(params);
Param new_params = new Param4<int, string, string, string>( chat_params.param1, "", "", chat_params.param4 );
super.OnEvent(eventTypeId,new_params);