Posts: 2,640
Threads: 122
Joined: Feb 2010
Reputation:
0
Anyone have this stock ?
IsPlayerInRangeOfVehicle(playerid, vehicleid, 15.0)
Something like this or
GetVehicleNearPlayer(vehicleid, playerid, distance)
Posts: 1,501
Threads: 19
Joined: Nov 2007
Reputation:
0
I think vehicles are synced by a player being in them. So it may not work if nobody is in the vehicle.
Posts: 2,640
Threads: 122
Joined: Feb 2010
Reputation:
0
hmmm this is tru
but thanks for the help
Posts: 1,506
Threads: 69
Joined: Feb 2008
Quote:
Originally Posted by Backwardsman97
I think vehicles are synced by a player being in them. So it may not work if nobody is in the vehicle.
|
This changed with 0.3, so vehicles are now synced at all times.
Damn you don't play SA:MP anymore? XD
pawn Код:
stock GetClosestVehicle(playerid, &Float:dis = (Float:0x7F800000))
{
dis = (Float:0x7F800000);
new Float:X, Float:Y, Float:Z;
if(GetPlayerPos(playerid, X, Y, Z)) {
new vehicleid = INVALID_VEHICLE_ID;
for(new v, Float:temp, Float:VX, Float:VY, Float:VZ; v != MAX_VEHICLES; v++) {
if(GetVehiclePos(v, VX, VY, VZ)) {
VX -= X, VY -= Y, VZ -= Z;
temp = VX * VX + VY * VY + VZ * VZ;
if(temp < dis) dis = temp, vehicleid = v;
}
}
dis = floatpower(dis, 0.5);
return vehicleid;
}
return INVALID_VEHICLE_ID;
}
I did not create this