package AutoGreeter
{
function newChatHud_addLine(%text)
{
if($canGreet == 1)
{
//Called when any line of text is added to the chat box
Parent::newChatHud_addLine(%text);
//This will turn the "jes00 connected." into "jes00"
%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',"Hi, " @ %nameToGreet);
}
}
}
};
activatePackage(AutoGreeter);
function ToggleGreet()
{
if($canGreet == 1) {
$canGreet = 0;
clientCmdMessageBoxOK("Auto Greeter, by jes00","Auto Greeter is now: Off.");
} else if($canGreet == 0) {
$cangreet = 1;
clientCmdMessageBoxOK("Auto Greeter, by jes00","Auto Greeter is now: On.");
}
}
This should work I tested it and ironed out the bugs