30.07.2009, 06:16
I don't know how to deal with textdraw.
Here's the function for aiming check, but it doesn't check z, because there's no such a 'z' angle.
stock isPlayerAimingArea(playerid, Float,Float:y,Float:centre){
new
Floatx,Floaty,Floatz,Floata;
GetPlayerPos(playerid,px,py,pz);
GetPlayerFacingAngle(playerid,pa);
Float:getInfrontXY(px,py,pa,DisBetweenPoints(px,py ,0,x,y,0));
return PointToPoint(px,py,0,x,y,0,centre);
}[/pawn]
Note:More detail, DIY
Here's the function for aiming check, but it doesn't check z, because there's no such a 'z' angle.
pawn Код:
//Author:yezizhu
#define DisBetweenPoints(%1,%2,%3,%4,%5,%6) floatsqroot(((%1-%4)*(%1-%4))+((%2-%5)+(%2-%5))+((%3-%6)*(%3-%6)))
//Author:too many guys
stock Float:getInfrontXY(&Float:x,&Float:y,Float:a,Float:distance){
new
Float:tmpx=x,
Float:tmpy=y;
x = tmpx+(distance*floatsin(-a, degrees));
y = tmpy+(distance*floatcos(-a, degrees));
}
//Author:***** - Alex
#define PointToPoint(%0,%1,%2,%3,%4,%5,%6) (((%0 - %3) * (%0 - %3)) + ((%1 - %4) * (%1 - %4)) + ((%2 - %5) * (%2 - %5)) <= %6 * %6)
new
Floatx,Floaty,Floatz,Floata;
GetPlayerPos(playerid,px,py,pz);
GetPlayerFacingAngle(playerid,pa);
Float:getInfrontXY(px,py,pa,DisBetweenPoints(px,py ,0,x,y,0));
return PointToPoint(px,py,0,x,y,0,centre);
}[/pawn]
Note:More detail, DIY