How to make [...]
#3

@Dusan: No, and what is this?
pawn Код:
new m = GetVehicleModel(vehicleid);
    if(m == 0) return 0;
Haven't you heard of IsValidVehicle? Yes, it's a real thing.

pawn Код:
#define FLOAT_INFINITY (Float:0x7F800000)
native IsValidVehicle(vehicleid);
stock GetPlayerNearestVehicle(playerid)
{
    new v = -1, Float:d = FLOAT_INFINITY, Float:p[6], FLoat:tmp;
    GetPlayerPos(playerid, p[0], p[1], p[2]);
    p[0] -= p[3]; p[1] -= p[4]; p[2] -= p[5];
    for(new i; i < MAX_VEHICLES; i++) if(IsValidVehicle(i)) {
        GetVehiclePos(i, p[3], p[4], p[5]);
        tmp = floatround(floatsqroot((p[0] * p[0]) + (p[1] * p[1]) + (p[2] * p[2])));
        if(tmp < d) {
            d = tmp;
            v = i;
        }
    }
    return IsValidVehicle(v) ? v : INVALID_VEHICLE_ID;
}
Reply


Messages In This Thread
How to make [...] - by Sn4ke2 - 21.06.2015, 18:20
Re: How to make [...] - by Dusan01 - 21.06.2015, 18:36
Re: How to make [...] - by Crayder - 21.06.2015, 18:46
Re: How to make [...] - by SickAttack - 21.06.2015, 19:09
Re: How to make [...] - by Sn4ke2 - 21.06.2015, 19:22

Forum Jump:


Users browsing this thread: 2 Guest(s)