Its impossible?
#1

How its impossible?

How i open boot or bonnet I have a out of car, exaple behind the car?
Reply
#2

SetVehicleParamsEx
Reply
#3

Yeas, but when i have behind the car, not in the car?
Reply
#4

Quote:
Originally Posted by TouhGear
Посмотреть сообщение
Yeas, but when i have behind the car, not in the car?
SetVehicleParamsEx uses vehicleID param, not PlayerID so you can do it while not in the car.
Reply
#5

some can give me code?
Reply
#6

https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
Reply
#7

pawn Код:
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,engine,lights,alarm,doors,1,1,objective);
Reply
#8

Код:
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?

But how make this? When i do not have any car at the, server say: you are not close to any car

How make this?
Reply
#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
#10

now how make the command?

Код:
CMD:openbonnet(playerid, params[])
{
             new vid = GetPlayerClosestVehicle(1.0, playerid);        
	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;
}
?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)