Author Topic: How do you make a on spawned event work correctly.  (Read 1662 times)

You have the parent function outside of any actual function and instead in the package, which will cause syntax errors.

Using GameConnection::onConnected will not work as it's a protected function and cannot be packaged or replaced. Use GameConnection::autoAdminCheck instead.


So....


Code: [Select]
$dscale = "0.5";
$spawnyes = 1;


function setscaleofguy(%client)
{
echo("Okay.");
%client.player.setplayerscale($dscale);
}

package kat {

function GameConnection::autoAdminCheck(%this)
{

if($spawnyes == 1){
$ST = schedule(500,0, setscaleofguy,%this);
}
}

};



activatepackage(kat);


....will work? Checking now,


You didn't parent it.

Can someone show me where the parent goes?
And what the "parent" will be for that code?

Code: [Select]
package kat
{
function GameConnection::autoAdminCheck(%this)
{
if($spawnyes == 1)
{
$ST = schedule(500,0, setscaleofguy,%this);
}
Parent::autoAdminCheck(%this)
}
};
activatepackage(kat);

Why are you setting the scale of the player during the auto admin check? Is this possible since there's no control object even created yet? Or is there? :o

That is true...

Do it in GameConnection::createPlayer or something. Then you could probably scale them with no delay or schedules necessary.

If it was autoAdminCheck though, I believe you have to return the parent.

Now, on the original idea, how would you make it so when a player spawns onto a brick, it processes an onSpawn input event? Cuz, from what I have experienced, when you spawn, it doesn't seem to trigger onPlayerTouch right away. Or would that have something to do with server lag?

That's inbuilt protection to stop starfishs making killing spawntraps. It gives a chance for people to get off the bricks doing the killing.

That's inbuilt protection to stop starfishs making killing spawntraps. It gives a chance for people to get off the bricks doing the killing.
Damn noobs ruin everything.

The minigame spawn functions return a transform, not a brick ID - you can't get the brick players have spawned on without hacky raycasts or badly overwriting the entire spawn code which isn't very good.

If we had something like "Minigame Events" a onPlayerSpawn event would be handy as then any abusiveness could be stopped by leaving the minigame. (or server if it's one of those forced ones)