02.07.2011, 03:45
Title says it all, does anyone have a solution?
stock GetCenterPoint(Float:Pos1, Float:Pos2)
{
new Float:dist;
if(Pos1 > Pos2) { dist = Pos1+((Pos1-Pos2)/2); }
else { dist = Pos2+((Pos2-Pos1)/2); }
return dist;
}
public OnPlayerDeath(playerid, killerid, reason)
{
new Float:F[3], Float:FF[3];
GetPlayerPos(playerid, F[0], F[1], F[2]);
GetPlayerPos(killerid, FF[0], FF[1], FF[2]);
new Float:X = GetCenterPoint(F[0], FF[0]);
new Float:Y = GetCenterPoint(F[1], FF[1]);
printf("Medium point: %f X & %f Y", X, Y);
return 1;
}
Try this:
PHP код:
PHP код:
|
stock GetMiddlePos(Float:x_1, Float:y_1, Float:x_2, Float:y_2, &Float:x_mid, &Float:y_mid)
{
x_mid = (x_1 + x_2) / 2; // Arithmetic mean value is all you need
y_mid = (y_1 + y_2) / 2;
}
SR[|x1-x2|**2 - |y1-y2|**2]
[(x1+x2)/2], [(y1+y2)/2]