SA-MP Forums Archive
Detect the part of vehicle - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Detect the part of vehicle (/showthread.php?tid=471153)



Detect the part of vehicle - MisterMania67 - 21.10.2013

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 !


Re: Detect the part of vehicle - [WA]iRonan - 21.10.2013

I guess you want to make synced shooting for vehicles?


Re : Detect the part of vehicle - MisterMania67 - 21.10.2013

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


Re: Detect the part of vehicle - Wizzy951 - 21.10.2013

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



Re : Detect the part of vehicle - MisterMania67 - 21.10.2013

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.


Re: Detect the part of vehicle - Wizzy951 - 21.10.2013

Okay, then check this.


Re : Detect the part of vehicle - MisterMania67 - 21.10.2013

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.


Re: Detect the part of vehicle - Wizzy951 - 21.10.2013

Just use the search button .. There

And you edited your main thread, didn't you ?


Re : Detect the part of vehicle - MisterMania67 - 21.10.2013

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.


Re : Detect the part of vehicle - MisterMania67 - 22.10.2013

Up ?