Author Topic: Client Sided Greeting  (Read 2149 times)

Chrono, could you explain to me how you would be able to do that?
Package clientCmdServerMessage to check and see if the first letter is the "\c(color here)" escape code. Then check if the last 29 letters are " has connected to the server."
Get the name inbetween that, and send a message to the server.

Code: [Select]
%name = strReplace(%msg," has connected to the server.","");
?

That'll still keep the name blue, but the server cuts that part out anyways.
So yeah that would work.

First parameter of clientCmdServerMessage will be 'MsgClientJoin' when someone joins.
Wait, maybe second. I don't know.

It's one of them... lol
Just trace it.

Code: [Select]

package clientgreeting{
//Checks to see if newguiplayerlist updated
function newguiplayerlist::update(%this, %cl, %name,%blid,%a,%b,%c)

{Parent::update(%this, %cl, %name,%blid,%a,%b,%c);
//Sends the message
commandtoserver('messagesent', "Hello "@%name@".");

}

};
//Activates the package
activatepackage(clientgreeting);
      

Thanks for your help guys.
Locking

Guess I might still need extra help.
« Last Edit: September 27, 2009, 10:39:24 PM by Deep2 »

Please organize your scripts. Although it's not necessary and will still work without, it is good practice for when you write larger scripts and need to find syntax or just need to think your script through.
Also your script will send hello messages to everyone on the server when you first join.

Please organize your scripts. Although it's not necessary and will still work without, it is good practice for when you write larger scripts and need to find syntax or just need to think your script through.
Also your script will send hello messages to everyone on the server when you first join.

Thanks Lil. How would I make it so it doesn't do it on join?

Read the topic, you'll find out.

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',"G'day " @ %nameToGreet);
}
}
};
activatePackage(niceToGreetYou);
« Last Edit: September 28, 2009, 07:04:36 AM by Destiny/Zack0Wack0 »

Needs to be fixed.
It's just " connected."


Quote
Truce: lol hey guess what, connected.
Destiny: G'day Truce: lol hey guess what,

Yep, needs more work obviously.
There's a message type arg for a reason.
'MsgClientJoin' give you any hints?

Yep, needs more work obviously.
There's a message type arg for a reason.
'MsgClientJoin' give you any hints?

Also, since it's a tagged string,

Code: [Select]
if(getTaggedString(%type) $= "MsgClientJoin")
That's one way to test it (where %type is the tagged string).