Blockland Forums > Modification Help

Script for new player joined

Pages: << < (2/2)

jes00:


--- Quote from: Wordy on March 01, 2012, 02:38:47 AM ---Instead, is their a onSpawn function?

--- End quote ---
Pretty sure it's GameConnection::spawnPlayer(%client).

austin615:

Okay so Greek2me and swollows's code do the same thing but Lugnut says that the code is wrong because you can't show a message on a players screen until they spawn.  Like wordy said, is there a OnSpawn function?

CityRPG:


--- Quote from: austin615 on March 01, 2012, 07:40:08 AM ---Okay so Greek2me and swollows's code do the same thing but Lugnut says that the code is wrong because you can't show a message on a players screen until they spawn.  Like wordy said, is there a OnSpawn function?

--- End quote ---
You don't have a grasp of the series of events.

1. GameConnection::onConnectRequest -- Before client joins. If %client is deleted immediately after this function, their connection is rejected.
2. GameConnection::autoAdminCheck -- After client connects to the server. Called after "Name has connected."
3. GameConnection::onClientEnterGame -- After client has finished downloading and has spawned for the first time.
4. GameConnection::spawnPlayer -- Any time the player spawns or respawns, for the first time or otherwise.

If you want to send a center print the first time a client spawns, package onClientEnterGame, call the parent, and then do a center print. That should work.

When packaging, ensure that all arguments are being considered at all times.

austin615:

Thanks  :cookieMonster: I got it working now!

Chrono:


--- Quote from: austin615 on March 01, 2012, 07:40:08 AM ---Okay so Greek2me and swollows's code do the same thing but Lugnut says that the code is wrong because you can't show a message on a players screen until they spawn.  Like wordy said, is there a OnSpawn function?

--- End quote ---
OnClientEnterGame is called when they spawn. (for the first time)

There's nothing wrong with using it.

Pages: << < (2/2)

Go to full version