04.10.2010, 16:15
Is there any function to check where does the player's camera looks at?
Kind of like GetPlayerFacingAngle.
Kind of like GetPlayerFacingAngle.
SetPlayerCameraLookAt
stock IsPlayerLookingAtFire(playerid, fireid)
{
new
Float:cX, Float:cY, Float:cZ,
Float:cPosX, Float:cPosY, Float:cPosZ,
Float:x1, Float:y1, Float:z1,
Float:x2, Float:y2, Float:z2,
Float:dX, Float:dY, Float:dZ;
GetVehiclePos(GetPlayerVehicleID(playerid), x1, y1, z1);
GetPlayerCameraPos(playerid, cPosX, cPosY, cPosZ);
GetPlayerCameraFrontVector(playerid, cX, cY, cZ);
x2 = FireInfo[fireid][firePosX];
y2 = FireInfo[fireid][firePosY];
z2 = FireInfo[fireid][firePosZ];
new Float:Dist = GetDistanceBetweenPoints(x1, y1, z1, x2, y2, z2);
dX = cPosX + floatmul(cX, Dist);
dY = cPosY + floatmul(cY, Dist);
dZ = cPosZ + floatmul(cZ, Dist);
if(GetDistanceBetweenPoints(x1, y1, z1, dX, dY, dZ) <= 50.0)
{
return true;
}
return false;
}
if(GetDistanceBetweenPoints(x1, y1, z1, dX, dY, dZ) <= 50.0)
if(GetDistanceBetweenPoints(x1, y1, z1, dX, dY, dZ) <= 5.0)
GetVehiclePos(GetPlayerVehicleID(playerid), x1, y1, z1);
//...
dX = cPosX + floatmul(cX, Dist);
dY = cPosY + floatmul(cY, Dist);
dZ = cPosZ + floatmul(cZ, Dist);
if(GetDistanceBetweenPoints(x1, y1, z1, dX, dY, dZ) <= 50.0)