Blockland Forums > Modification Help

GameConnection::spawnPlayer - Stuck on Loading Objects

Pages: (1/2) > >>

brickybob:

Pretty simple, this line below gets me stuck on Loading Objects.  I can mess with F8/F7 and see the world but I won't have a character and would just be an invisible person, just watching.

--- Code: ---function GameConnection::spawnPlayer(%client)
{
talk("A summoner has reconnected!");
}
--- End code ---


Port:

You didn't package it. Also, if you only want to do this when they finish loading, use ::onClientEnterGame instead.

jes00:

(If this is server sided)Don't forget to parent it.

Ipquarx:

Here you go, packaged and parented.
--- Code: ---package somepackage
{
function GameConnection::spawnPlayer(%Client)
{
parent::spawnPlayer(%Client);
//Do Stuff Here
}
};
activatepackage(somepackage);
--- End code ---


CityRPG:

No. spawnPlayer returns the created player object. Do not use that code, you will break other add-ons.


--- Code: ---package somepackage
{
function GameConnection::spawnPlayer(%client)
{
// Stuff that happens before the player spawns.

%result = parent::spawnPlayer(%client);

// Stuff that happens after the player spawns.

return %result;
}
};
activatepackage(somepackage);
--- End code ---

Always, always, always check to see if the parent returns a value when packaging a function or you will break core functionality.

P.S. It violates coding semantics to start a variable with a capital letter.

Pages: (1/2) > >>

Go to full version