21.03.2012, 07:57
You could try this:
Make global floats and the id for the vehicle for max players.
Then, when the player presses they key to enter the vehicle, calculate like this:
Make global floats and the id for the vehicle for max players.
Then, when the player presses they key to enter the vehicle, calculate like this:
pawn Код:
for(new vehicleid=0;vehicleid<MAX_VEHICLES;vehicleid++)
{
GetPlayerPos(playerid, x1, y1, z1);
if(IsVehicleInRangeOfPoint(playerid, ~1.0, x1, y1, z1);
{
GetVehiclePos(vehicleid, x2, y2, z2);
x3=x1-x2;
y3=y1-y2;
z3=z1-z2;
}
//When the player wants to exit:
GetVehicle(vehicleid, x2, y2, z2);
SetPlayerPos(playerid, x2-x3, y2-y3, z2-z3);
stock IsVehicleInRangeOfPoint(vehicleid, Float:radi, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetVehiclePos(vehicleid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}

