Author Topic: GameConnection::onconnect help stuff  (Read 1603 times)

Well I know that if you want something to happen when you connect, you would write this:
Code: [Select]
GameConnection::onconnect
SO what would it be when a player SPAWNS?
Thanks =D

Check the default minigame script. It makes you join the minigame when you spawn so....

Check the default minigame script. It makes you join the minigame when you spawn so....
It makes you join the minigame when you JOIN... Thanks anyway

Here is some code from default minigame.
Code: [Select]
package SetMini {
function GameConnection::onClientEnterGame(%this)
{
%client = %this;
schedule(100,0,"SetMinigame",%client);
parent::onClientEnterGame(%this);
}
};
activatepackage(SetMini);
Could that be it?
« Last Edit: April 11, 2009, 08:24:43 AM by heedicalking »

Here is some code from default minigame.
Code: [Select]
package SetMini {
function GameConnection[b]::onClientEnterGame[/b](%this)
{
%client = %this;
schedule(100,0,"SetMinigame",%client);
parent::onClientEnterGame(%this);
}
};
activatepackage(SetMini);
Could that be it?
Heh, heh, yah. THANKS!

Code: [Select]
package Name {
function GameConnection::spawnPlayer(%this)
{
%this.dostuff();
parent::SpawnPlayer(%this);
}
};
activatepackage(Name);
Wow you guys were completely off.

You can't package GameConnection::OnConnect, Badspot declared it so.

Code: [Select]
package Name {
function GameConnection::spawnPlayer(%this)
{
%this.dostuff();
parent::SpawnPlayer(%this);
}
};
activatepackage(Name);
Wow you guys were completely off.
spawnPlayer is used every time a player spawns.
onClientEnterGame is used when you first spawn in the server, which is ideal for when the Default Minigame makes you join it.
Both are valid.

You could also package GameConnection::autoAdminCheck() as that is used when a player first connects. (regardless of whether they are auto admin or not)