this may help
https://sampwiki.blast.hk/wiki/GetVehicleModelInfo id say check if your within 0.5 units from the VEHICLE_MODEL_INFO_WHEELSREAR |
stock CheckPlayerDistanceToVehicle(Float:radi, playerid, vehicleid) { if(IsPlayerConnected(playerid)) { new Float:PX,Float:PY,Float:PZ,Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,PX,PY,PZ); GetVehiclePos(vehicleid, X,Y,Z); new Float:Distance = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ); if(Distance <= radi*radi) { return 1; } } return 0; }
stock CheckPlayerDistanceToVehicle(Float:rad, playerid, vehicleid) { new Float:vx, Float:vy, Float:vz; GetVehiclePos(vehicleid, vx, vy, vz); if(IsPlayerInRangeOfPoint(playerid, rad, vx, vy, vz)) return 1; return 0; }
Код:
stock CheckPlayerDistanceToVehicle(Float:radi, playerid, vehicleid) { if(IsPlayerConnected(playerid)) { new Float:PX,Float:PY,Float:PZ,Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,PX,PY,PZ); GetVehiclePos(vehicleid, X,Y,Z); new Float:Distance = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ); if(Distance <= radi*radi) { return 1; } } return 0; } |
Код:
stock CheckPlayerDistanceToVehicle(Float:radi, playerid, vehicleid) { if(IsPlayerConnected(playerid)) { new Float:PX,Float:PY,Float:PZ,Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,PX,PY,PZ); GetVehiclePos(vehicleid, X,Y,Z); new Float:Distance = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ); if(Distance <= radi*radi) { return 1; } } return 0; } |
stock IsPlayerNearBoot( playerid, vehicleid)
{
new Float:X, Float:Y, Float:Z;
GetVehicleModelInfo(vehicleid, VEHICLE_MODEL_INFO_WHEELSREAR , X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 0.5, X, Y, Z)) return 1;
return 0;
}
kinda like this but this function only tells if your close to a vehicle
not if your at the back of it. @op Im not gonna write this for you, try writing the code use IsPlayerInRangeOfPoint and the other links i given. |
you may have to tweak this
pawn Код:
|
GetVehicleModelInfo(vehicleid, VEHICLE_MODEL_INFO_WHEELSREAR , X, Y, Z);
GetVehicleModelInfo(PlayerCar1, VEHICLE_MODEL_INFO_WHEELSREAR , X, Y, Z);
if(IsPlayerNearBoot( playerid, PlayerCar1))
{
//they are near PlayerCar1's boot
}
if(IsPlayerNearBoot( playerid, PlayerCar2))
{
//they are near PlayerCar2's boot
}