Author Topic: How do you client-sidedly...?  (Read 1747 times)

Which function is called when you spawn, or otherwise, how would I cause actions to happen when I spawn?
Is there a way to measure distance to an object by looking at it client sidedly?

1. Not 100% sure. Run a trace before it says "Click to spawn." and see what happens. I'm sure there is one.

2. No. There is server-side, but Badspot disabled most mathematical functions relating to players because of aimbot scripts.

how would I cause actions to happen when I spawn?
A 'HandleYourSpawn' callback.

Also:My apologies about the ambiguous title.

There is probably a better way to handle your client spawning than parenting a low level function, but I'm not about to go trace for it so here you are:
Code: [Select]
package WhenISpawn {
function serverConnection::setControlObject(%this, %obj)
{
%return = parent::setControlObject(%this, %obj);
if(%obj.getClassname() $= "Player")
whenISpawn();
return %return;
}
};
activatePackage(WhenISpawn);
Only issue is this will probably catch when you hit f7 as an admin. Too lazy to check for a better function.

Is there a way to measure distance to an object by looking at it client sidedly?

getFocusDistance()

There is probably a better way to handle your client spawning than parenting a low level function, but I'm not about to go trace for it so here you are:
Code: [Select]
package WhenISpawn {
function serverConnection::setControlObject(%this, %obj)
{
%return = parent::setControlObject(%this, %obj);
if(%obj.getClassname() $= "Player")
whenISpawn();
return %return;
}
};
activatePackage(WhenISpawn);
Only issue is this will probably catch when you hit f7 as an admin. Too lazy to check for a better function.
I used handleYourSpawn() and it works perfectly..


function playGui::onWake(%this) {

That's what I use, at least in Age of Time. (So I could auto-login.) Less useful, doesn't directly say you spawned, but it happens when you begin to see so...

I don't think he means just first time spawning.

That would also get called whenever you look at PlayGui through the f10 window and when you close the f11 editor.

function playGui::onWake(%this) {

That's what I use, at least in Age of Time. (So I could auto-login.) Less useful, doesn't directly say you spawned, but it happens when you begin to see so...
Can you parent onWake?

Yes, you can. Although it's not completely useful here, it might be an alternative if any problems are found.

Can you parent onWake?
There's no default GuiControl::onWake function so it'll give console spam every time you open a GUI that calls a parent, but considering that these functions should be defined on the base level anyways there's no reason not to. Even Ephialtes refuses to fix the TCPObject::onDisconnect console spam because it should work in a specific, proper way and it does not.

There's no default GuiControl::onWake function so it'll give console spam every time you open a GUI that calls a parent, but considering that these functions should be defined on the base level anyways there's no reason not to. Even Ephialtes refuses to fix the TCPObject::onDisconnect console spam because it should work in a specific, proper way and it does not.
He probably means in a package.

He probably means in a package.
oh.

If you ever, for any reason, are overwriting a default function that you did not create on an object you did not write, you must package it, you must call the parent (unless you're purposefully defusing the default functionality), and you should return a value if the original function does.