#define CMDTARGET_OBEY_IMMUNITY (1<<0) // Obey immunity #define CMDTARGET_ALLOW_SELF (1<<1) // Allow self targeting #define CMDTARGET_ONLY_ALIVE (1<<2) // Target must be alive #define CMDTARGET_NO_BOTS (1<<3) // Target can't be a bot
Example: The range is 1-5 and the base value (seed) is 3, the offset that the value should be moved by is also 3. Offsetting the value by 3 would result in 6, but it is to be constrained between 1 and 5. With clamp() this would result in 5, but this function rolls the value over and returns 1 instead.
Lower bound
Higher bound
Base value
Offset to move
Computed offset value between specified bounds
stock constraint_offset(low, high, seed, offset)
{
new numElements = high - low + 1;
offset += seed - low;
if (offset >= 0)
{
return low + (offset % numElements);
}
else
{
return high - (abs(offset) % numElements) + 1;
}
return 0; // Makes the compiler happy -_-
}This documentation was generated automatically using pawn-docgen written by xPaw for AlliedMods.