21.08.2010, 17:05
i have this command:
When i use this command for example to /lock, the server just lagged for 10 seconds .
[ i got only 30 vehicles in the server.]
how i can fix it?
pawn Код:
stock GetClosestVehicle(playerid) //
{
new car, Float:ang;
car = -1;
ang = 9999.9999;
for(new i = 0; i < MAX_PLAYERS; i++)
for(new v = 0; v < MAX_VEHICLES; v++)
{
#define INVALID_ID (0xFFFF) //65535
if(!IsPlayerConnected(i) && v == INVALID_ID) continue;
if(!IsPlayerInVehicle(i, v))
{
new Float:X, Float:Y, Float:Z;
GetVehiclePos(v, X, Y, Z);
if(ang > GetDistanceBetwinPoint(playerid, X, Y, Z))
{
ang = GetDistanceBetwinPoint(playerid, X, Y, Z);
car = v;
}
}
}
return car;
}
[ i got only 30 vehicles in the server.]
how i can fix it?