Author Topic: GameConnection::"?"()  (Read 1435 times)

This code basically sends a message, or messages, to the player when they enter the server without having to type a 'slash command'.

Code: [Select]
package Announce
{
function GameConnection::OnClientEnterGame(%client)
{
messageClient(%client,"","\c2Test1");
messageClient(%client,"","\c2Test2");
messageClient(%client,"","\c2Test3");
messageClient(%client,"","\c2Test4");
messageClient(%client,"","\c2Test5");
messageClient(%client,"","\c2Test6");
Parent::OnClientEnterGame(%client);
}
};
activatePackage(Announce);

Right now it only sends the messages right after spawning, what I'm after is for it to send the messages immediately when you enter the server (like, the loading screen).
I figured what was needed to be changed was in between GameConnection:: and (), but I could be wrong.
Any help/corrections would be appreciated.

You'd need to parent the onConnectionAccepted method which I believe is a protected method and can't be packaged or overwritten.

Sorry, I forgot to add that I have hardly any knowledge of scripting.
So I'm guessing, that you mean I cannot do what I'm after by simple scripting or at all?

I made a similiar thing back in v8 with a package of GameConnection::onConnect

Code: [Select]
package rules
{
function GameConnection::onConnect(%this,%name)
{
Parent::onConnect(%this,%name);
%file = new FileObject();
%file.openForRead("add-ons/rules.txt");
while(!%file.isEOF())
{
msg(%this,%file.readLine());
}
%file.close();
%file.delete();
messageClient(%this,'','\c2Please press ~ to view the server rules');
}
};
ActivatePackage(rules);

Reads the rules from a txt file in add-ons, and sent them to the console instead of spamming the chat.

Er, You can't overwrite or package over the onConnect method either.

Well, I did back in v8. And it worked just fine.

Well guess what, we're on v9 now.

Uhh yea, I realize that. And if it doesn't work, sorry for trying to help.

Well then if I can't make it appear on the loading screen, I now only ask, is there anything that should be changed, deleted, or is unnecessary or useless in the script?
« Last Edit: October 04, 2008, 07:16:12 PM by -Starwars- »

Uhh yea, I realize that. And if it doesn't work, sorry for trying to help.

If you're going to help, you should test your ideas first before filling someone's head with assumptions.

Isnt it not possible to redo the Welcome message or something like IGSO does?

The welcome message is in a variable. The rules are not.

I suppose you could put your rules in your welcome message.

I wanted to do something separate from anything else, that's why I made the script. I thought about using the IGSO welcome message, but I considered it to be a hassle.
While this way is a little more easier for the user.

I'm satisfied with what I got. And anyone else is welcome to use the script.
Of course I wouldn't mind credit if you use it in something. :D

Er, You can't overwrite or package over the onConnect method either.
Yeah I was shocked about that. It made me very sad.

It just makes it harder for idiots to break the auth system, which is a good thing.