Blockland Forums > Modification Help
redirecting chat
(1/2) > >>
Gartanium:
I'm making a new game for my server called mafia. Some of the features of my game that I would like to include are the dead being unable to talk to living people, only mafia can see mafia chat at night, only law enforcement can see law enforcement chat at night, and so forth. I know how to stop a message from being sent to the server, but I don't know how to make it so only certain people can see a message. Any help would be great =).
otto-san:
That's more simple than you think.


--- Code: ---package myTeamChattyThing
{
function serverCmdMessageSent(%client, %text)
{
if($isNight)
{
parent::serverCmdMessageSent(%client, %text);
}
else
{
switch$(%client.currentTeam)
{
case "Mafia":
for(%i = 0; %i < clientGroup.getCount(); %i++)
{
if(clientGroup.getObject(%i).currentTeam $= "Mafia")
messageClient(clientGroup.getObject(%i),'',"\c3"@%client.getPlayerName()@" (MAFIA)\c6: "@%text);
}
case "Law":
for(%i = 0; %i < clientGroup.getCount(); %i++)
{
if(clientGroup.getObject(%i).currentTeam $= "Law")
messageClient(clientGroup.getObject(%i),'',"\c3"@%client.getPlayerName()@" (LAW)\c6: "@%text);
}
}
}
}
};
activatePackage(myTeamChattyThing);
--- End code ---

Adapt to your code.
Gartanium:
Thanks.
Greek2me:
Just don't release that, it'll break a lot of stuff because it redirects chat to a server message.
Chrono:
Please do not use untagged messageClient() functions.

Please do use commandToClient(%cl = clientGroup.getObject(%i),'chatmessage','\c3%2 (MAFIA)\c5: %4',%cl.clanprefix,%cl.getPlayerName(),%cl.clanSuffix,%text);

Thank you for having regards to client add-ons that don't want to break due to faulty chat modifying server add-ons.
Navigation
Message Index
Next page

Go to full version