Author Topic: Is this right?  (Read 627 times)

I want each client to see the gui when they spawn. so,is this right?

Code: [Select]
if(gameWindowExists() && !$Server::Dedicated)
{
   if(!%client)
      exec("Add-Ons/Map_CityRPG/CityRPGSpawnGui.gui");
}

if(!%client)
What.

also, not unless your .gui file has something to bring it up.

i would package it to happen after the default spawn function.  Best bet would be to do a schedule for 0 ms, because I see spawn guis all the time that close instantly after opening becasue they appeared to soon.

Everyone is missing the obvious issue that executing a gui on the server is not going to open it on the client.

Everyone is missing the obvious issue that executing a gui on the server is not going to open it on the client.
I was hinting at that seeing if he would be able to figure it out from my post.

Everyone is missing the obvious issue that executing a gui on the server is not going to open it on the client.

I assumed that he would have some sort of client released to make this work, or meant something like message box ok.  That is a good point.

I want each client to see the gui when they spawn. so,is this right?

Code: [Select]
if(gameWindowExists() && !$Server::Dedicated)
{
   if(!%client)
      exec("Add-Ons/Map_CityRPG/CityRPGSpawnGui.gui");
}
Wont work like your intending.  You need both a client.cs and a server.cs in your mod.  you cant mix client and server code in the same file


in server.cs:
Code: [Select]
package Whatever
  {
   function GameConnection::SpawnPlayer(%this, ....)
     {
      commandToClient(%this, 'openMyGui');
      return parent::SpawnPlayer(%this, ....)
     }
  }

then in client.cs
Code: [Select]
exec("Add-Ons/Map_CityRPG/CityRPGSpawnGui.gui");

function clientCmdOpenMyGui()
  {
   Canvas.pushDialog(CityRPGSpawnGui);
  }


Just keep in mind if you do this, then everyone must have your mod in order to see the gui.  Another option is to RTB's GUI download feature.