FuelcapXY - 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: FuelcapXY (
/showthread.php?tid=354359)
FuelcapXY -
iGetty - 26.06.2012
How can I get the position of a fuelcap from this?
pawn Код:
stock TrunkXY(playerid, &Float:x2, &Float:y2, Float:distance)
{
new
Float:a,
Float:z
;
GetPlayerPos(playerid, x2, y2, z);
GetPlayerFacingAngle(playerid, a);
if(GetPlayerVehicleID(playerid))
{
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
x2 += (distance * floatsin(-a+180, degrees));
y2 += (distance * floatcos(-a+180, degrees));
SetPlayerCheckpoint(playerid, x2, y2, z, 1.0);
}
Thanks!
Re: FuelcapXY -
Vince - 26.06.2012
GetVehicleModelInfo with VEHICLE_MODEL_INFO_PETROLCAP. This returns offsets, so you'll need to add them to the current vehicle's positions.
Re: FuelcapXY -
iGetty - 28.06.2012
I tried that Vince, but I don't know how to do it.
Would it be:
pawn Код:
command(cap, playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:x, Float:y, Float:z, Float:cX, Float:cY, Float:cZ;
GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
GetVehicleModelInfo(GetVehicleModel(GetPlayerVehicleID(playerid), VEHICLE_MODEL_INFO_PETROLCAP, cX, cY, xZ);
SetPlayerCheckpoint(playerid, x+cX, y+cY, z+cZ, 1.0);
}
else return SendClientMessage(playerid, WHITE, "You aren't in a vehicle.");
}