"my $limit = 0; if ($vehicle->{otype} =~ /Old_bike.*/) { $limit = 10; } elsif ($vehicle->{otype} =~ /UAZ.*|S1203.*|.*boat.*/) { $limit = 4; } elsif ($vehicle->{otype} =~ /ATV.*|Skoda.*|TT650.*|UH1H.*|hilux.*|Ikarus.*|Tractor|Volha.*/) { $limit = 3; } elsif ($vehicle->{otype} =~ /V3S.*|Ural.*|PBX|SUV.*/) { $limit = 1; } # Skip this spawn if the vehicle is over its per-type limit if ($limit > 0 && $count >= $limit) { print "INFO: Vehicle $vehicle->{otype} is at its limit of $limit spawns\n"; next; } # Skip this spawn if the spawn chance was not met if (int(rand(100)) > ($vehicle->{chance} * 100)) { next; } # Generate random damage value my $damage = rand(0.75); if ($damage <= 0.05 or $vehicle->{otype} =~ /Old_bike.*/) { $damage = 0; } # Generate random parts damage my $health = ''; if ($vehicle->{otype} =~ /Old_bike.*/) { @parts = (); } elsif ($vehicle->{otype} =~ /TT650.*|.*boat.*|PBX/) { @parts = ('["motor",1]'); } elsif ($vehicle->{otype} =~ /UH1H.*/) { @parts = ('["motor",1]','["elektronika",1]','["mala vrtule",1]','["velka vrtule",1]'); } else { @parts = ('["palivo",1]','["motor",1]','["karoserie",1]','["wheel_1_1_steering",1]','["wheel_1_2_steering",1]','["wheel_2_1_steering",1]','["wheel_2_2_steering",1]'); } $health = genDamage(@parts); # Execute insert $spawnCount++; $insert->execute($vehicle->{uuid}, $vehicle->{pos}, $health, $damage, $vehicle->{otype}, $db{'instance'}); print "Called insert with ($vehicle->{uuid}, $vehicle->{pos}, $health, $damage, $vehicle->{otype}, $db{'instance'})\n"; }" That's mine^