Blockland Forums > Modification Help

VehicleGroup

Pages: (1/2) > >>

Greek2me:

You know how there's DatablockGroup and ClientGroup? Is there a vehicle equivalent? What I'm trying to do is respawn all vehicles in the server without using serverCmdResetVehicles. I could make my own, but it'd be nice if there was a default group for them already.

otto-san:

No, pretty sure there isn't or I'm not very good at math.

Iban:

Vehicles belong to the group MissionCleanup.

Your best bet would be to cycle through the client's BrickGroup, checking for isObject(BrickGroup_1649.getObject(%i).vehicle).

For instance:


--- Code: ---function getAllVehicles()
{
for(%a = 0; %a < ClientGroup.getCount(); %a++)
{
%client = ClientGroup.getObject(%a);
%brickGroup = %client.brickGroup;

for(%b = 0; %b < %brickGroup.getCount(); %b++)
{
%brick = %brickGroup.getObject(%b);

if(isObject(%brick.vehicle))
{
echo("Vehicle" SPC %brick.vehicle.getID() SPC "owned by" SPC %client.name);
}
}
}
}

--- End code ---


Greek2me:


--- Quote from: Iban on March 04, 2011, 07:08:16 PM ---Your best bet would be to cycle through the client's BrickGroup, checking for isObject(BrickGroup_1649.getObject(%i).vehicle).

--- End quote ---
I've done that already. It gets very inefficient with a lot of bricks.

Iban:


--- Quote from: Greek2me on March 04, 2011, 07:09:43 PM ---I've done that already. It gets very inefficient with a lot of bricks.

--- End quote ---
Then be clever.

Make your own SimSet called "VehicleSet" and make it so that every time a vehicle is added it goes into that set.

You're not going to find a cookie cutter solution to every problem. Eventually you'll have to think on your own.

Pages: (1/2) > >>

Go to full version