Mathy questions.
#2

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:

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;
}
Reply


Messages In This Thread
Mathy questions. - by MP2 - 21.03.2012, 05:08
Re: Mathy questions. - by Unte99 - 21.03.2012, 07:57
Re: Mathy questions. - by Babul - 21.03.2012, 11:54
Re: Mathy questions. - by MP2 - 21.03.2012, 12:30

Forum Jump:


Users browsing this thread: 1 Guest(s)