Quote:
|
Originally Posted by KuJi
I mean over the ENTIRE script he didnt need to trigger the server to join it x.x
|
Perhaps he is using a state-approach, where he joins a class in one state, and another class in another.
Example:
PHP Code:
// CLASSES/State1
function DoSomething() {
echo("Currently in State 1.");
}
function LeavingState() {
echo("Leaving State 1");
}
function JoiningState() {
echo("Joining State 1");
}
PHP Code:
// CLASSES/State2
function DoSomething() {
echo("Currently in State 2.");
}
function LeavingState() {
echo("Leaving State 2");
}
function JoiningState() {
echo("Joining State 2");
}
PHP Code:
// Some Object
function onCreated() {
SetState(1);
}
function onPlayerChats() {
if(player.chat.starts("/changestate")) {
temp.state = (temp.state == 1 ? 2 : 1);
SetState(temp.state);
} else if(player.chat.starts("/dosomething")) {
this.DoSomething();
}
}
function SetState(stateNum) {
if(this.state in |1,2|) {
temp.oldstate = this.state;
this.LeavingState();
this.leave("State" @ temp.oldstate);
}
this.state = stateNum;
this.join("State" @ this.state);
this.JoiningState();
}