Author Topic: Respawn all vehicles  (Read 1049 times)

Okay, i tried making a script that would respawn all vehicles when a servercmd is used:
Code: [Select]
function serverCmdrespawnallvehicles(%obj)
{
  if(!%client.isAdmin|| %client.isSuperAdmin)
      return;
   
   if($Server::BrickCount > 0)
messageAll('Msgrespawn', "There is nothing to respawn.");

   %groupCount = MainBrickGroup.getCount();
   for(%i = 0; %i < %groupCount; %i++)
   {
      %group = MainBrickGroup.getObject(%i);
      %count = %group.getCount();
      for(%j = 0; %j < %count; %j++)
      {
         %brick = %group.getObject(%j);
                 if(!(%brick.getType() & $TypeMasks::FxBrickAlwaysObjectType))
            continue;
         if(%brickData.uiName $= "Vehicle Spawn")
         {
         fxDTSBrick::spawnVehicle(%brick)
}
}
}
}

What am i doing wrong?

Is there not already a command that does this? I haven't used admin in a long time.

Is there not already a command that does this? I haven't used admin in a long time.

/resetVehicles

/resetVehicles

Heh, i was never aware of that.
Thanks to both.
/lock