Its impossible?
#9

Quote:
Originally Posted by TouhGear
Посмотреть сообщение
Код:
CMD:openbonnet(playerid, params[])
{
	new vid;
	new engine,lights,alarm,doors,bonnet,boot,objective;
	GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
	SetVehicleParamsEx(vid,engine,lights,alarm,doors,1,boot,objective);
	return 1;
}
like this?
vid is the VehicleID, you need to know it!
when a player is in the car you want it then you can use
vid = GetPlayerVehicleID(playerid);

else assign an id to the vehicle at creation for later use.
another way is to loop all vehicles and compare distances and pick the closest one to your X Y Z point.

(eg:
pawn Код:
getPlayerClosestVehicle(playerid, Float:maximumDistance=-1.0)
{
    if(!IsPlayerConnected(playerid))
        return -1;

    new
        closestVehicle = -1,
        Float:closestDistance = -1.0,
        Float:currentDistance = 0.0,
        Float:x0, Float:y0, Float:z0,
        Float:x1, Float:y1, Float:z1;

    GetPlayerPos(playerid, x0, y0, z0);
    for(new checkVehicle; checkVehicle < MAX_VEHICLES; checkVehicle++)
    {
        if(!GetVehicleModel(checkVehicle)) // jeżeli pojazd o ID 'checkVehicle' ma model o ID '0' to pomijamy go
            continue;
        GetVehiclePos(checkVehicle, x1, y1, z1);
        currentDistance = floatsqroot(floatadd(floatadd(floatpower(floatsub(x0, x1), 2), floatpower(floatsub(y0, y1), 2)), floatpower(floatsub(z0, z1), 2)));
        if((maximumDistance == -1.0 || currentDistance < maximumDistance) && (closestDistance == -1.0 || currentDistance < closestDistance))
        {
            closestDistance = currentDistance;
            closestVehicle = checkVehicle;
        }
    }
    return closestVehicle;
}
)
Reply


Messages In This Thread
Its impossible? - by TouhGear - 20.12.2011, 14:01
Re: Its impossible? - by §с†¶e®РµРe - 20.12.2011, 14:01
Re: Its impossible? - by TouhGear - 20.12.2011, 14:03
Re: Its impossible? - by Gamer_Z - 20.12.2011, 14:06
Re: Its impossible? - by TouhGear - 20.12.2011, 14:11
Re: Its impossible? - by Gamer_Z - 20.12.2011, 14:15
Re: Its impossible? - by kizla - 20.12.2011, 14:16
Re: Its impossible? - by TouhGear - 20.12.2011, 14:20
Re: Its impossible? - by Gamer_Z - 20.12.2011, 14:22
Re: Its impossible? - by TouhGear - 20.12.2011, 14:28

Forum Jump:


Users browsing this thread: 1 Guest(s)