Blockland Forums > Modification Help
Player Group
(1/1)
Brian Smithers:
PlayerGroup, like client group but for players.
This wont work, nothing happens, and on use, it crashes.

--- Code: ---if(!isObject(PlayerGroup))
new ScriptGroup(PlayerGroup);
package PlayerGroup_Beta
{
function GameConnection::createPlayer(%client)
{
parent::createPlayer(%client);
PlayerGroup.add(%client.player);
}
function PLayer::playThread(%this,%slot,%thread)
{
parent::playThread(%this,%slot,%thread);
if(%thread $= "Death")
PlayerGroup.remove(%this);
}
function Player::delete(%this)
{
for(%i=0;%i<PlayerGroup.getCount();%i++)
{
if(PlayerGroup.getObject(%i) $= %this && PlayerGroup.getState() !$= "Dead")
PlayerGroup.remove(%this);
}
parent::delete(%this);
}
};activatepackage(PlayerGroup_Beta);

--- End code ---
Greek2me:
This should do the trick:


--- Code: ---if(!isObject(playerGroup))
new simSet(playerGroup);

package PlayerGroup
{
function Player::onAdd(%this)
{
parent::onAdd(%this);
playerGroup.schedule(0,add,%this);
}
};
activatePackage(PlayerGroup);
--- End code ---
Brian Smithers:

--- Quote from: Greek2me on January 26, 2012, 06:27:37 PM ---This should do the trick:


--- Code: ---if(!isObject(playerGroup))
new simSet(playerGroup);

package PlayerGroup
{
function Player::onAdd(%this)
{
parent::onAdd(%this);
playerGroup.schedule(0,add,%this);
}
};
activatePackage(PlayerGroup);
--- End code ---

--- End quote ---
I fixed it myself with a bit of stuff.
Navigation
Message Index

Go to full version