Author Topic: Playertypename::onSpawn?  (Read 679 times)

Is it possible to make a function that executes when the player spawns?

function GameConnection::onClientEnterGame()
{

}

With packaging, of course.

function GameConnection::onClientEnterGame()
{

}

With packaging, of course.
Will it work when the player dies and respawns?


Try it.
The thing is, the command I used made me freeze at Loading Objects.

What if I want the player to spawn and have his scale set to 2?

Would it be something along the lines of:
Code: [Select]
package spawnsize
{
   function OnGameConnection::onClientEnterGame(%c)
   {
       %client.player.setscale("2 2 2");
    }
}
activatepackage(spawnsize);
?

You forgot to parent it.

I didn't realize you didn't know too much, so here:

package asdf
{
    function GameConnection::onClientEnterGame(%client)
    {
        return parent::onClientEnterGame(%client);
    }
};

I think he's asking for when a specific player type spawns though.
If you want it when any player spawns with any player type use what Kalphiter posted.

If you want it only when a player spawns with a certain datablock use Playertypename::onAdd(%db,%obj)

For any client spawning use spawnPlayer not onClientEnterGame. That's called once. When they enter the game.
For certain datablocks spawning, use Armor::onNewDatablock. I don't think you have to return the parent call.

For any client spawning use spawnPlayer not onClientEnterGame. That's called once. When they enter the game.
For certain datablocks spawning, use Armor::onNewDatablock. I don't think you have to return the parent call.
I think Kalphiter was just confused by the first post though. It is not very descriptive of what he wants. The OP needs to clear things up.

Also I wasn't sure whether it was onNewDatablock or onAdd. Thanks for the correction.

For any client spawning use spawnPlayer not onClientEnterGame. That's called once. When they enter the game.
I can't believe Kalphiter would mess something like that up, espically when he's released add-ons with oncliententergame in them before.

I can't believe Kalphiter would mess something like that up, espically when he's released add-ons with oncliententergame in them before.
I think Kalphiter was just confused by the first post though. It is not very descriptive of what he wants. The OP needs to clear things up.