Author Topic: Making events work on the client that triggered it.  (Read 514 times)

Yes, I know this event is from central hub, but I wanted to make them work on online servers too, I got them to load, and they function fine, but only on the host.  It doesn't matter who triggers it, or even who planted the brick.
Code: [Select]
registerOutputEvent("GameConnection", "GoToMainMenu");
registerOutputEvent("GameConnection", "StartServer");
registerOutputEvent("GameConnection", "JoinServer");
registerOutputEvent("GameConnection", "OpenOptions");
registerOutputEvent("GameConnection", "QuitGame");
registerOutputEvent("GameConnection", "OpenModManager");
registerOutputEvent("GameConnection", "OpenIRCClient");


function GameConnection::GoToMainMenu(%this)
{
disconnect();
}
function GameConnection::StartServer(%this)
{
canvas.pushDialog(StartMissionGUI);
}
function GameConnection::JoinServer(%this)
{
canvas.pushDialog(JoinServerGUI);
}
function GameConnection::OpenOptions(%this)
{
canvas.pushDialog(OptionsDlg);
}
function GameConnection::QuitGame(%this)
{
quit();
}
function GameConnection::OpenModManager(%this)
{
canvas.pushDialog(RTB_ModManager);
}
function GameConnection::OpenIRCClient(%this)
{
canvas.pushDialog(RTB_IRCClient);
}

This is the code from events.cs


The only one thats possible through an online server is the Disconnect, with %this.delete();

You could use clientcmds, but those wouldn't work for players who don't have your mod.

Stop trying to make hub work online. They use client sided commands through server sided methods which will only EVER work for the host and that's why this is only used for single player.