Author Topic: ChatMsgAll outside of minigames  (Read 1053 times)

Basically what the title says. CenterPrintAll and BottomPrintAll would be great to have, too. And don't bother with admin-only whatever things, I would only use this for certain events inside a build without wanting to force everyone inside a minigame. usually I use wrench events admin only, anyways. However, some people might prefer an admin-only version, but I really don't care. Thanks in advance :)

This sounds like a cool idea. /support

This would be relatively easy to do, I could have sworn it's been done before

If you still need this in a few hours remind me and I'll do it

Code: [Select]
registerOutputEvent(fxDtsBrick, "ChatMessageServer", "STRING 200 150", 1);
registerOutputEvent(fxDtsBrick, "CenterPrintServer", "STRING 200 150 INTEGER 0 10", 1);
registerOutputEvent(fxDtsBrick, "BottomPrintServer", "STRING 200 150 INTEGER 0 10 BOOL", 1);

function fxDtsBrick::ChatMessageServer(%this, %msg, %oClient)
{
%numClients = ClientGroup.getCount();
for(%i; %i<numClients; %i++)
{
%client = ClientGroup.get(%i);
messageClient(%client,'', %msg);
}
}

function fxDtsBrick::CenterPrintServer(%this, %msg, %time, %oClient)
{
%numClients = ClientGroup.getCount();
for(%i; %i<numClients; %i++)
{
%client = ClientGroup.get(%i);
%client.centerPrint(%msg,%time);
}
}

function fxDtsBrick::BottomPrintServer(%this, %msg, %time, %bar, %oClient)
{
%numClients = ClientGroup.getCount();
for(%i; %i<numClients; %i++)
{
%client = ClientGroup.get(%i);
%client.centerPrint(%msg,%time,%bar);
}
}

I don't have time to test this, but this is generally what you need. You can test it out by copying all the code and then entering eval(getclipboard()); into the console while hosting a server. Though you'll want it packaged as an add-on if you want it to function properly.
« Last Edit: February 15, 2013, 04:18:50 PM by pecon98 »

I can't test it anymore before I go to bed, but many thanks still. The first thing I'm doing when I get up is testing it out.

Pecon, you have the BottomPrint register set to your ChatMessageServer function.

until pecon fixes his

Code: [Select]
registerOutputEvent(fxDtsBrick, "ChatMessageServer", "STRING 200 150", 1);
registerOutputEvent(fxDtsBrick, "CenterPrintServer", "STRING 200 150 INTEGER 0 10", 1);
registerOutputEvent(fxDtsBrick, "BottomPrintServer", "STRING 200 150 INTEGER 0 10 BOOL", 1);

function fxDtsBrick::ChatMessageServer(%this, %msg, %oClient)
{
%numClients = ClientGroup.getCount();
for(%i; %i<numClients; %i++)
{
%client = ClientGroup.get(%i);
messageClient(%client,'', %msg);
}
}

function fxDtsBrick::CenterPrintServer(%this, %msg, %time, %oClient)
{
%numClients = ClientGroup.getCount();
for(%i; %i<numClients; %i++)
{
%client = ClientGroup.get(%i);
%client.centerPrint(%msg,%time);
}
}

function fxDtsBrick::BottomPrintServer(%this, %msg, %time, %bar, %oClient)
{
%numClients = ClientGroup.getCount();
for(%i; %i<numClients; %i++)
{
%client = ClientGroup.get(%i);
%client.centerPrint(%msg,%time,%bar);
}
}
« Last Edit: February 15, 2013, 04:17:31 PM by Yola² »

You have two of the functions on CenterPrint.
Code: [Select]
registerOutputEvent(fxDtsBrick, "ChatMessageServer", "STRING 200 150", 1);
registerOutputEvent(fxDtsBrick, "CenterPrintServer", "STRING 200 150 INTEGER 0 10", 1);
registerOutputEvent(fxDtsBrick, "BottomPrintServer", "STRING 200 150 INTEGER 0 10 BOOL", 1);

function fxDtsBrick::ChatMessageServer(%this, %msg, %oClient)
{
%numClients = ClientGroup.getCount();
for(%i; %i<numClients; %i++)
{
%client = ClientGroup.get(%i);
                messageClient(%client,'', %msg);
}
}

function fxDtsBrick::CenterPrintServer(%this, %msg, %time, %oClient)
{
%numClients = ClientGroup.getCount();
for(%i; %i<numClients; %i++)
{
%client = ClientGroup.get(%i);
%client.centerPrint(%msg,%time);

}
}

function fxDtsBrick::BottomPrintServer(%this, %msg, %time, %bar, %oClient)
{
%numClients = ClientGroup.getCount();
for(%i; %i<numClients; %i++)
{
%client = ClientGroup.get(%i);
%client.bottomPrint(%msg,%time,%bar);
}
}
Isn't this the right code for it?
« Last Edit: February 16, 2013, 06:29:05 PM by WALDO »

You have two of the functions on CenterPrint.

Isn't this the right code for it?

That's my exact code.

That's my exact code.
Code: [Select]
function fxDtsBrick::BottomPrintServer(%this, %msg, %time, %bar, %oClient)
{
%numClients = ClientGroup.getCount();
for(%i; %i<numClients; %i++)
{
%client = ClientGroup.get(%i);
%client.centerPrint(%msg,%time,%bar);
}
}
This is your version.

Code: [Select]
function fxDtsBrick::BottomPrintServer(%this, %msg, %time, %bar, %oClient)
{
%numClients = ClientGroup.getCount();
for(%i; %i<numClients; %i++)
{
%client = ClientGroup.get(%i);
%client.bottomPrint(%msg,%time,%bar);
}
}
This is my version. Read the print commands, they are different between our versions.


This is my version.

I put the differences in bold.

ahh.

Didn't read through the actual functions, sorry.

While the events show up in the list, they don't seem to have any effect atall for any of the scripts posted above :|

While the events show up in the list, they don't seem to have any effect atall for any of the scripts posted above :|

Just to test a single part of it, restart your server, copy this and enter eval(getclipboard()); in console.

Code: [Select]
registerOutputEvent( "fxDTSBrick", "chatMessageServer", "string 200 150" );

function fxDTSBrick::chatMessageServer( %this, %message )
{
messageAll( '', %mesage );
}

In case you guys missed the subtlety in port's post, you should use messageAll for the chatmessage one instead of overcomplicating things

I see people suggesting codes for scripting, but idk how to script.
Plus, I'd need an event if I were to use it.
Sounds awesome tho, I'd download.
 :cookie:

In case you guys missed the subtlety in port's post, you should use messageAll for the chatmessage one instead of overcomplicating things
Or you could just use the announce command. That usually works.