15.10.2012, 09:59
Two functions I've made some time ago, they work perfectly:
pawn Code:
native IsValidVehicle(vehicleid); // YOU NEED TO PUT THIS IN YOUR SCRIPT!
stock RandCar()
{
new rand = random(MAX_VEHICLES);
while (!IsValidVehicle(rand)) rand = random(MAX_VEHICLES);
return rand;
}
stock RandPlayer()
{
new rand = random(MAX_PLAYERS);
while (!IsPlayerConnected(rand)) rand = random(MAX_PLAYERS);
return rand;
}