Check vehicles nearby
#3

No need for storing each vehicle's data
pawn Код:
native IsValidVehicle(vehicleid);

stock IsPlayerNearRancher(playerid) {

    for(new v = 0; v < MAX_VEHICLES; v++) {
        if(IsValidVehicle(v) && GetVehicleModel(v) == VEH_RANCHER) {
            new Float: x, Float: y, Float: z;
            GetVehiclePos(v, x, y, z);

            if(IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z))
                return 1;
        }
    }
    return 0;
}

// In a timer
if(IsPlayerNearRancher(playerid)) {
    // code
}
Reply


Messages In This Thread
Check vehicles nearby - by Drak03 - 26.03.2018, 12:55
Re: Check vehicles nearby - by v1k1nG - 26.03.2018, 13:32
Re: Check vehicles nearby - by Grim_ - 26.03.2018, 13:48
Re: Check vehicles nearby - by v1k1nG - 26.03.2018, 14:55
Re: Check vehicles nearby - by Grim_ - 26.03.2018, 15:01
Re: Check vehicles nearby - by v1k1nG - 26.03.2018, 15:26
Re: Check vehicles nearby - by Grim_ - 26.03.2018, 15:41
Re: Check vehicles nearby - by v1k1nG - 26.03.2018, 16:05
Re: Check vehicles nearby - by Lokii - 26.03.2018, 16:27
Re: Check vehicles nearby - by Grim_ - 26.03.2018, 17:32

Forum Jump:


Users browsing this thread: 2 Guest(s)