public function __construct($id, $type, $dbid, $model, $color, Position $parking, $health = 100, $fuel = 1, $age = 0, Account $owner = null) { $this->type = $type; $this->color[0] = $color[0]; $this->color[1] = $color[1]; $this->dbid = $dbid; $this->health = $health; $this->fuel = $fuel; $this->age = $age; $this->model = $model; if ($this->type == VEHICLE_SHOP) { $this->respawn = 10; } else { $this->respawn = 7200; } if ($id == -1) { /* We must create the vehicle in SAMP */ if ($parking->x != 0 && $parking->y != 0 && $parking->z != 0 && $parking->angle != 0) { /* Make sure that it has a spawn position, if not the player must do /callcar */ $this->id = CreateVehicle($this->model, $parking->x, $parking->y, $parking->z, $parking->angle, $this->color[0], $this->color[1], $this->respawn); } else { $this->id = -1; } } else { $this->id = $id; } $this->attributes = Vehicles::GetAttributes($model); if ($this->age < 48 * 3600) { $this->class = 1; $this->fuelusage = $this->attributes->GetFuelUsage(); } else { if ($this->age < (48 + 40) * 3600) { $this->class = 2; $this->fuelusage = $this->attributes->GetFuelSpace() / (DEFAULT_FUELTIME - 300); /* Penalty of 5 minutes of fuel */ } else { if ($this->age < (48 + 40 + 35) * 3600) { $this->class = 3; $this->fuelusage = $this->attributes->GetFuelSpace() / (DEFAULT_FUELTIME - 600); /* Penalty of 10 minutes of fuel */ } else { $this->class = 4; $this->fuelusage = $this->attributes->GetfuelSpace() / (DEFAULT_FUELTIME - 900); /* Penalty of 15 minutes of fuel */ } } } /* Add this vehicle to the vehicles list */ Vehicles::Add($this); }