[Ajuda] Duvida Sobre Player e Veнculo - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Duvida Sobre Player e Veнculo (
/showthread.php?tid=657108)
Duvida Sobre Player e Veнculo -
ThiagoGamemodes - 01.08.2018
Gostaria de Saber como posso saber quando que o player estб na parte traseira do veнculo, no porta-malas, procurei na search e nгo encontrei sobre, sei que os sistemas de porta-malas sу abrem quando o player estб na parte traseira, mas qual a funзгo que verifica se estб ou nгo na parte traseira?, obrigado desde jб!
Re: Duvida Sobre Player e Veнculo -
willttoonn - 01.08.2018
Use o
GetVehicleModelInfo. Eu utilizo esta funзгo para tal necessidade. Faзa bom uso.
pawn Code:
stock GetVehicleBoot(vehicleid, &Float:x, &Float:y, &Float:z)
{
if (!GetVehicleModel(vehicleid) || vehicleid == INVALID_VEHICLE_ID)
return (x = 0.0, y = 0.0, z = 0.0), 0;
static
Float:pos[7]
;
GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, pos[0], pos[1], pos[2]);
GetVehiclePos(vehicleid, pos[3], pos[4], pos[5]);
GetVehicleZAngle(vehicleid, pos[6]);
x = pos[3] - (floatsqroot(pos[1] + pos[1]) * floatsin(-pos[6], degrees));
y = pos[4] - (floatsqroot(pos[1] + pos[1]) * floatcos(-pos[6], degrees));
z = pos[5];
return 1;
}
stock IsPlayerNearBoot(playerid, vehicleid)
{
static
Float:fX,
Float:fY,
Float:fZ;
GetVehicleBoot(vehicleid, fX, fY, fZ);
return (GetPlayerVirtualWorld(playerid) == GetVehicleVirtualWorld(vehicleid)) && IsPlayerInRangeOfPoint(playerid, 4.5, fX, fY, fZ);
}
Re: Duvida Sobre Player e Veнculo -
ThiagoGamemodes - 01.08.2018
Quote:
Originally Posted by willttoonn
Use o GetVehicleModelInfo. Eu utilizo esta funзгo para tal necessidade. Faзa bom uso.
pawn Code:
stock GetVehicleBoot(vehicleid, &Float:x, &Float:y, &Float:z) { if (!GetVehicleModel(vehicleid) || vehicleid == INVALID_VEHICLE_ID) return (x = 0.0, y = 0.0, z = 0.0), 0;
static Float:pos[7] ; GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_SIZE, pos[0], pos[1], pos[2]); GetVehiclePos(vehicleid, pos[3], pos[4], pos[5]); GetVehicleZAngle(vehicleid, pos[6]);
x = pos[3] - (floatsqroot(pos[1] + pos[1]) * floatsin(-pos[6], degrees)); y = pos[4] - (floatsqroot(pos[1] + pos[1]) * floatcos(-pos[6], degrees)); z = pos[5]; return 1; }
stock IsPlayerNearBoot(playerid, vehicleid) { static Float:fX, Float:fY, Float:fZ;
GetVehicleBoot(vehicleid, fX, fY, fZ);
return (GetPlayerVirtualWorld(playerid) == GetVehicleVirtualWorld(vehicleid)) && IsPlayerInRangeOfPoint(playerid, 4.5, fX, fY, fZ); }
|
Obrigado