That's possible ?
#1

Hey,

I want to get random 'X,Y,Z' from area (MinX,MinY,MaxX,MaxY).
That's possible?
Reply
#2

pawn Код:
stock Float:frandom(Float:max, Float:min = 0.0, dp = 4) // Credit to ******
{
    new Float:mul = floatpower(10.0, dp),
    imin = floatround(min * mul),
    imax = floatround(max * mul);
    return float(random(imax - imin) + imin) / mul;
}

new Float:RandomX=frandom(MaxX,MinX);
new Float:RandomY=frandom(MaxY,MinY);
new Float:RandomZ=frandom(MaxZ,MinZ);

SetPlayerPos(playerid,RandomX,RandomY,RandomZ);
EDIT: ive done some research and found a better one
Reply
#3

Z coordinate can be wrong
Reply
#4

Quote:
Originally Posted by Quickie
Посмотреть сообщение
pawn Код:
stock Float:frandom(Float:max, Float:min = 0.0, dp = 4) // Credit to ******
{
    new Float:mul = floatpower(10.0, dp),
    imin = floatround(min * mul),
    imax = floatround(max * mul);
    return float(random(imax - imin) + imin) / mul;
}

new Float:RandomX=frandom(MaxX,MinX);
new Float:RandomY=frandom(MaxY,MinY);
new Float:RandomZ=frandom(MaxZ,MinZ);

SetPlayerPos(playerid,RandomX,RandomY,RandomZ);
EDIT: ive done some research and found a better one
Looking good, but if I didn't define 'MaxZ' & 'MinZ', how can I get 'Z' coordination?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)