Author Topic: VehicleGroup  (Read 563 times)

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.

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

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: [Select]
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);
}
}
}
}
« Last Edit: March 04, 2011, 07:11:04 PM by Iban »

Your best bet would be to cycle through the client's BrickGroup, checking for isObject(BrickGroup_1649.getObject(%i).vehicle).
I've done that already. It gets very inefficient with a lot of bricks.

I've done that already. It gets very inefficient with a lot of bricks.
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.

You're not going to find a cookie cutter solution to every problem. Eventually you'll have to think on your own.
Obviously. No need to act like I have no idea what I'm doing. I'm currently working on a project that has 1848 lines of code (and still missing a ton of features) plus 1618 lines of GUI.
« Last Edit: March 04, 2011, 07:19:13 PM by Greek2me »