Particle's Custom RPG

Assistance => Assistance & Feedback => Topic started by: bigbigger9 on September 20, 2003 11:55 pm CDT

Title: Another Question From Me: Server Triggers
Post by: bigbigger9 on September 20, 2003 11:55 pm CDT
What kind of server triggers are there?

Edit: Like, onclientkill or something?

(Note: The reason I'm asking all these server questions, is because this is my first time doing some server scripting)
Title:
Post by: UnderGod on September 21, 2003 12:47 am CDT
What kind of triggers?

There are too many to list.

Think about it like this.. There is a trigger for every alteration in the game / gameplay.
Title:
Post by: bigbigger9 on September 21, 2003 01:41 am CDT
heh, well, like the client connected to the server, the client killing someone, the client being killed, but I'd like to focus on the client being connected or along that line.
Title:
Post by: Dragoon on September 21, 2003 07:51 am CDT
Server::onClientConnect(%clientId)

if you are using base mod, that function is in server.cs.  if you are using TRPG, that function is in connectivity.cs.
Title:
Post by: bigbigger9 on September 21, 2003 11:03 am CDT
Thanks.  :wink:
Title:
Post by: Dragoon on September 21, 2003 12:00 pm CDT
function Server::onClientConnect(%clientId)
{
   if(!String::NCompare(Client::getTransportAddress(%clientId), "LOOPBACK", 8))
   {
      %clientId.isAdmin = true;
      %clientId.isSuperAdmin = true;
   }

   echo("- Connect -");
   echo((%NM=Client::getName(%clientId)) @ ", " @ (%IP=Client::getTransportAddress(%clientId)));
   echo("- - - - - -");

   Client::LogIP(%NM, %IP);

   %clientId.noghost = true;
   %clientId.messageFilter = -1;
   remoteEval(%clientId, SVInfo, version(), $Server::Hostname, $modList, $Server::Info, $ItemFavoritesKey);
   remoteEval(%clientId, MODInfo, $MODInfo);
   remoteEval(%clientId, FileURL, $Server::FileURL);

   for(%i = 0; %i < 10; %i++)
      $Client::info[%clientId, %i] = "";

   Game::onPlayerConnected(%clientId);
}

function Client::LogIP(%NM, %IP)
{
   $Connect = %NM @ " [" @ %IP @ "]";

   export("$Connect", "temp\\IPLog.txt");
   deleteVariables("$Connect");
}
Title:
Post by: bigbigger9 on September 21, 2003 01:40 pm CDT
So just add to the function?
Title:
Post by: Dragoon on September 21, 2003 01:45 pm CDT
you can do whatever the hell you want big.  nothing is hardcoded to tribes...  you can change almost everything through the code.  if you wanted, you could even do:

function Server::onClientConnect(%clientId)
{
DoConnectStuff(%clientId);
LoadPlayerSettings(%clientId);
FinalizePlayer(%clientId);
}

and make those 3 functions do whatever you want, everything can be changed, but with your level of coding, i wouldn't recommend too much of the complete re-writes, they can get very complex very fast.
Title:
Post by: bigbigger9 on September 21, 2003 02:15 pm CDT
heh, yea. I've only done client scripting, and I'm not modding the game, I'm just adding some stuff, you'll see soon enough what this is all for, but I doubt you'll care, since most people here don't play CTF for Tribes 1. I'll be sure to be give credit to you guys for helping me out so much.
Title:
Post by: Dragoon on September 21, 2003 02:29 pm CDT
actually, some of us will care, the others won't.  me personally... i won't give a damn as i have done so much with tribes that some noob scripters stuff doesn't really impress me, nothing personal...
Title:
Post by: bigbigger9 on September 21, 2003 10:50 pm CDT
Why isn't schedule(); working in comchat.cs?

schedule("net::kick(%clientId, \"Bye.\");",5);

It works in console, just not in the comchat.cs
Title:
Post by: UnderGod on September 21, 2003 11:58 pm CDT
Is %clientID defined?
Title:
Post by: bigbigger9 on September 21, 2003 11:58 pm CDT
Yes.

Edit: I'll try something real quick and make positive.
Title:
Post by: UnderGod on September 22, 2003 12:02 am CDT
schedule("net::kick(%clientId, "Bye");",5);

Try it like this for kicks and giggles.
Title:
Post by: bigbigger9 on September 22, 2003 12:03 am CDT
Quote from: "UnderGod"
schedule("net::kick(%clientId, "Bye");",5);

Try it like this for kicks and giggles.


I'm already kicking and giggling, but hey, why not? I'm bored.

Later: Ah, didn't even bother trying this, but I made some variables global and it worked... I have no idea why making them global worked, but hey, I don't care, as long as it worked.
Title:
Post by: Hersh on September 22, 2003 05:46 pm CDT
Pay attention to what you name your globals, you may make something later and forget that you already used something.

Hersh