Problem
#9

For dialogs: Yes, Im using gamer's include for making dialogs faster if you have > 100 those, at this moment I have +-200

For GetClosestVehicle:

pawn Код:
stock GetClosestVehicle(playerid)
{
    new Float:distance = 99980001, vehicleid = Cars, Float:pPos[3];
    GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
    for(new vehid = 1; vehid != Cars; ++vehid)
    {
        new Float:vPos[3];
        GetVehiclePos(vehid, vPos[0], vPos[1], vPos[2]);
        if(vPos[0] == 0.000 && vPos[1] == 0.000 && vPos[2] == 0.000) continue;
        else
        {
            new Float:newdistance;
            vPos[0] -= pPos[0];
            vPos[1] -= pPos[1];
            vPos[2] -= vPos[2];
            newdistance = vPos[0] * vPos[0] + vPos[1] * vPos[1] + vPos[2] * vPos[2];
            if(newdistance < distance)
            {
                vehicleid = vehid;
                distance = newdistance;
                return vehicleid;
            }
        }
    }
    return INVALID_VEHICLE_ID;
}
I found ^ somewhere in this forum.
Reply


Messages In This Thread
Problem - by Gh0sT_ - 28.07.2011, 19:20
Re: Problem - by Gh0sT_ - 28.07.2011, 20:54
Re: Problem - by Kaperstone - 28.07.2011, 21:05
Re: Problem - by Gh0sT_ - 28.07.2011, 21:11
Re: Problem - by Kaperstone - 28.07.2011, 21:52
Re: Problem - by Gh0sT_ - 28.07.2011, 21:55
Re: Problem - by Amit_B - 28.07.2011, 21:59
Re: Problem - by Krx17 - 28.07.2011, 22:00
Re: Problem - by Gh0sT_ - 28.07.2011, 22:02
Re: Problem - by Amit_B - 28.07.2011, 22:13
Re: Problem - by Gh0sT_ - 28.07.2011, 22:19
Re: Problem - by Gh0sT_ - 28.07.2011, 22:30

Forum Jump:


Users browsing this thread: 1 Guest(s)