Detect the part of vehicle
#1

Hi everyone !

I would like know how detect the parts of a vehicle.
I have find a function for detect the behind of a vehicle, but i dont know how to detect the front and the petrol cab.

Function for detect the behind:

pawn Код:
stock GetPosBehindVehicle(vehicleid, &Float:x, &Float:y, &Float:z, Float:offset=0.5)
{
    new Float:vehicleSize[3], Float:vehiclePos[3];
    GetVehiclePos(vehicleid, vehiclePos[0], vehiclePos[1], vehiclePos[2]);
    GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, vehicleSize[0], vehicleSize[1], vehicleSize[2]);
    GetXYBehindVehicle(vehicleid, vehiclePos[0], vehiclePos[1], (vehicleSize[1]/2)+offset);
    x = vehiclePos[0];
    y = vehiclePos[1];
    z = vehiclePos[2];
    return 1;
}

GetXYBehindVehicle(vehicleid, &Float:q, &Float:w, Float:distance)
{
    new Float:a;
    GetVehiclePos(vehicleid, q, w, a);
    GetVehicleZAngle(vehicleid, a);
    q += (distance * -floatsin(-a, degrees));
    w += (distance * -floatcos(-a, degrees));
}
Thanks you in advance everyone !
Reply
#2

I guess you want to make synced shooting for vehicles?
Reply
#3

No, I would like detect the part of a vehicle for create a command, example: "/open bonnet".
Reply
#4

This may help you.

And your command will look like:
pawn Код:
CMD:bonnet(playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, true, boot, objective);
return 1;
}
Reply
#5

Yes I know but my gamemode is a roleplay. I would like detect the positions for as player can use the command only if he is before the bonnet.
Reply
#6

Okay, then check this.
Reply
#7

Thanks, but look my topic ^^
I use already this function, but i don't know how change this function for detect the bonnet of a vehicle.
Reply
#8

Just use the search button .. There

And you edited your main thread, didn't you ?
Reply
#9

Thanks, I go to test the function and no, i don't edit the main thread.

EDIT:
Its not working. The function not detect the positions of the bonnet.
Reply
#10

Up ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)