19.11.2010, 16:33
Modulus for variables with the Float tag:
Example usage -
"Normalize" an angle (in degrees):
Enjoy.
pawn Код:
stock Float:operator%(Float:dividend, Float:divisor)
return (dividend - ((((dividend / divisor) - floatfract(dividend / divisor)) + float((_:(dividend / divisor) & cellmin) != 0)) * divisor));
"Normalize" an angle (in degrees):
pawn Код:
NormalizeAngle(&Float:angle)
{
angle = angle % 360.0;
if(angle < 0.0)
angle += 360.0;
}