Blockland Forums > Modification Help
Check when player connects?
Swollow:
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: ---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);
--- End code ---
Fluff-is-back:
You could use:
--- Code: ---GameConnection::autoAdminCheck(%client)
--- End code ---
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: ---package niceToGreetYou
{
function GameConnection::autoAdminCheck(%client)
{
commandToServer('messageSent', "Hey," SPC %client.name);
parent::autoAdminCheck(%client);
}
};
activatePackage(niceToGreetYou);
--- End code ---
Swollow:
Wait would that work client sided or only server sided and how do you parent things?
Fluff-is-back:
That is Server Sided.
Chrono:
Please don't use scripts like this.
It really bothers people, and done horribly wrong at that.