Author Topic: Check when player connects?  (Read 934 times)

Mr.jacksaunt gave me a script called client greet
I was trying to fine tune it to make it work for my needs but I ran into a problem If somebody types "connected" or "<stuff here> connected"
It activates the script is there any way you can check for connection of a player?
I'm not all that good a scripting so I need some help.
Code: [Select]
package niceToGreetYou
{
function newChatHud_addLine(%text)
{
//Called when any line of text is added to the chat box
Parent::newChatHud_addLine(%text);
//This will turn the "Destiny connected." into "Destiny"
%nameToGreet = strReplace(%text," connected.","");
//If the %nameToGreet variable is different to the original line greet them,
//otherwise it's something else
if(%nameToGreet !$= %text)
{
//Send a chat message saying hi to the player who joined (%nameToGreet)
commandtoserver('messagesent',"Hey, " @ %nameToGreet);
}
}
};
activatePackage(niceToGreetYou);

You could use:

Code: [Select]
GameConnection::autoAdminCheck(%client)
It runs as a client connects to a server. Just don't forget to parent it or no one on your server gets auto admin.

So:

Code: [Select]
package niceToGreetYou
{
function GameConnection::autoAdminCheck(%client)
{
commandToServer('messageSent', "Hey," SPC %client.name);
parent::autoAdminCheck(%client);
}
};
activatePackage(niceToGreetYou);
« Last Edit: December 04, 2010, 11:53:36 AM by Fluff-is-back »

Wait would that work client sided or only server sided and how do you parent things?


Please don't use scripts like this.

It really bothers people, and done horribly wrong at that.

Please don't use scripts like this.

It really bothers people, and done horribly wrong at that.
I'm not using them I'm trying to learn.

You won't learn many useful things from that.

I'm assuming this returns the string that's literally outputtedi n the chat, if so you could check if ": " is anywhere in the string. This won't work if someone joins who's name is "Whatever: Hi" but I've never seen anyone with a name like that so I assume it isn't possible.

secureClientCmd_clientJoin
or
secureClientCmdClientJoin

Don't remember which one.

secureClientCmd_clientJoin
or
secureClientCmdClientJoin

Don't remember which one.

First one, but I'm with Chrono: this will only annoy people.