Lag problem
#1

i have this command:
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;
}
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?
Reply


Messages In This Thread
Lag problem - by vection - 21.08.2010, 17:05
Re: Lag problem - by papagei9 - 21.08.2010, 18:17
Re: Lag problem - by Mike Garber - 21.08.2010, 18:26
Re: Lag problem - by vection - 21.08.2010, 19:02

Forum Jump:


Users browsing this thread: 1 Guest(s)