04.02.2014, 13:32
Okay so i am working on mission system and when i type /work i want a starting location thats close by so you dont have to drive for miles. Now i got this:
Now how do i make it so it only gives me a closeby location?
pawn Код:
stock Product_GetRandomStartLoc(ProductID)
{
// Setup local variables
new NumProducts;
// First find out how many valid start-locations there are in this product
for (new i; i < 30; i++)
{
// If the product has a valid location in this index
if (ALoads[ProductID][FromLocations][i] != 0)
NumProducts++; // Count the number of valid start-locations
else // A start-location with ID 0 has been found (dummy-location)
break; // Stop counting
}
// Return the LocationID that's stored at a random index
return ALoads[ProductID][FromLocations][random(NumProducts)];
}