bool: IsPlayerInZone(playerid, Float:minx, Float:miny, Float:maxx, Float:maxy) {
GetPlayerPos(playerid, P[playerid][px], P[playerid][py], P[playerid][pz]);
if (P[playerid][px] > minx && P[playerid][px] < maxx && P[playerid][py] > miny && P[playerid][py] < maxy) return true;
return false;
}
From YSI:
Код:
new Float:x = FloatRandom(minx, maxx); new Float:y = FloatRandom(miny, maxy); |
frandom(Float:max, Float:min = 0.0, dp = 4)
{
new
// Get the multiplication for storing fractional parts.
Float:mul = floatpower(10.0, dp),
// Get the max and min as integers, with extra dp.
imin = floatround(min * mul),
imax = floatround(max * mul);
// Get a random int between two bounds and convert it to a float.
return float(random(imax - imin) + imin) / mul;
}
return float(random(imax - imin) + imin) / mul;
Float:frandom(Float:max, Float:min = 0.0, dp = 4)
{
new
// Get the multiplication for storing fractional parts.
Float:mul = floatpower(10.0, dp),
// Get the max and min as integers, with extra dp.
imin = floatround(min * mul),
imax = floatround(max * mul);
new Float: x = float(random(imax - imin) + imin) / mul;
// Get a random int between two bounds and convert it to a float.
return x;
}