Author Topic: Client Sided Greeting  (Read 2153 times)

I got most of it, except I don't know how to target myself to send the message, without using findclientbyname(); which is a server function. Any help?

Code: [Select]
package Greeting {

GameConnection::OnClientEnterGame(%client) {

servercmdMessageSent(%HowdoItargetMyselfWithoutFCBN, "Welcome " %client)

}

};

activate package(Greeting);

As i've seen other client sided talk scripts in action, id like to know how this is possible.
Help?



I got most of it, except I don't know how to target myself to send the message, without using findclientbyname(); which is a server function. Any help?

Code: [Select]
package Greeting {

GameConnection::OnClientEnterGame(%client) {

servercmdMessageSent(%HowdoItargetMyselfWithoutFCBN, "Welcome " %client)

}

};

activate package(Greeting);

As i've seen other client sided talk scripts in action, id like to know how this is possible.
Help?



findClientByName() isn't the only server sided function you are using here, gameConnection::onClientEnterGame() is also server sided. (I don't believe you have any gameConnection objects as a client anyway.)

servercmdMessageSent() is also server sided, the way things are sent to the server via a script is through commandToServer() and naturally, to send a command to a client from a server, one would use commandToClient()
In this case, you would do the following: commandToServer('messageSent', "Your spam... er, chat here.");

You sir are not on the right track.

Start by tracing what functions are called on your client whenever a different client joins: I'll give you a head start, look for clientCmdServerMessage().

Alright I traced it and found  handleClientJoin();.

Is that the right one?

And if it is, would the script come as...

Code: [Select]
package Greeting {

handleclientjoin(%client)

{

commandtoserver('messagesent', "Welcome " %client);

    }

};

activate package(Greeting);

If there are any mistakes please correct me.
Thanks.

I would use NewPlayerListGui::update()

And this:
commandtoserver('messagesent', "Welcome " %client);
Would give syntax errors. First of all, %client is going to be some number, not their name. In the NewPlayerListGui::update(), one of the args is their name, so use that. Second of all, you would need to catenate the name variable in their by adding a "@","SPC","TAB", or "NL". So, the result should be
Code: [Select]
commandToServer('messageSent',"Welcome "@ %name);If you name the variable %name, that is.


Isn't that protected?
Not unless Badspot protected it within the past two days. It's been workin fine for me.

::update gets called when you join a server though. So when you joined the server you'd immediately be saying:
"Hey Jeff!"
"Sup bobby"
"Yo rich"
"Hi"
You'd have to find a way to make sure that it doesn't get called when you first join a server.

Not unless Badspot protected it within the past two days. It's been workin fine for me.
Oh, weird. Badspot protected some things in the Player GUI so I thought he'd do that one.

The only thing he did to it was make so you can't send false data through it.
i.e. server tells you Badspot has been added to the list, when he never actually joined. Data gets rejected.

::update gets called when you join a server though. So when you joined the server you'd immediately be saying:
"Hey Jeff!"
"Sup bobby"
"Yo rich"
"Hi"
You'd have to find a way to make sure that it doesn't get called when you first join a server.
Oh, I forgot this was for a greeting while the topic clearly says it's a greeting. Haha woops.

::update gets called when you join a server though. So when you joined the server you'd immediately be saying:
"Hey Jeff!"
"Sup bobby"
"Yo rich"
"Hi"
You'd have to find a way to make sure that it doesn't get called when you first join a server.
That's why you could do it with server messages instead.

That way you can set it to check if the server tells you...
<NAMEHERE> has connected to the server.
Then send the message.

This'll be very easy with my CCSS Engine, but I wont release it.

Hint: With my CCSS Engine it would go like this:
Code: [Select]
package Greeting
{
     function CCSS::onSelfEnterGame(%hostname,%this)
     {
          commandToServer('messageSent',ccssFindClient(%this),"Hey "@%hostname@".");
          ccssParent::onSelfEnterGame(%hostname,%this)
     }
}
activatePackage(Greeting);
//Please do not flame with the reason "you used functions not existing in BL!",
//cause that this uses my own CCSS engine, which creates those functions and stuff.
//Please do not flame with the reason "You used server sided functions!",
//cause my engine is client-sided.

Code: [Select]
//Please do not flame with the reason "you used functions not existing in BL!",
//cause that this uses my own CCSS engine, which creates those functions and stuff.
//Please do not flame with the reason "You used server sided functions!",
//cause my engine is client-sided.

You still used invalid syntax though.

Chrono, could you explain to me how you would be able to do that?

handleClientJoin(); - protected as of V11.

March 22, 22:00 EST
ID collecting script "ported" by me for V11. One of the few things that have ever needed porting to V11.