28.01.2010, 13:27
Title. I want to see how close I am to the vehicle limit >_>
new
count;
// when you create vehicles
count++;
printf("%d vehicles",count);
stock CountAddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:angle, color1, color2, respawn_delay) { count++; return AddStaticVehicleEx(modelid, spawn_x, spawn_y, spawn_z, angle, color1, color2, respawn_delay); }
stock GetVehicleCount(playerid)
{
new vehlimit = 2000;
new vehcount;
new string[32];
for(new v = 1; v < MAX_VEHICLES; v++)
{
if (IsVehicleSpawned(v)) vehcount++;
}
format(string, sizeof(string), "Total vehicles (%d), MAX: (%d)", vehcount, vehlimit);
SendClientMessage(playerid, 0xa9c4e4ff, string);
print(string);
}
stock IsVehicleSpawned(vehicleid)
{
new Float:VX, Float:VY, Float:VZ;
GetVehiclePos(vehicleid, VX, VY, VZ);
if (VX == 0.0 && VY == 0.0 && VZ == 0.0) return 0;
return 1;
}