Getting only closeby starting locations for missions - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Getting only closeby starting locations for missions (
/showthread.php?tid=492563)
Getting only closeby starting locations for missions -
thimo - 04.02.2014
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:
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)];
}
Now how do i make it so it only gives me a closeby location?