Creating a randomized x,y,z coords within a zone
#1

I was wondering if there's a way to generate a random xyz coord within a zone. I can't seem to find how to do this and not sure how to do it.
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=591010

pawn Код:
// By AbyssMorgan
GetRandomPointInRectangle(Float:minx,Float:miny,Float:maxx,Float:maxy,&Float:tx,&Float:ty){
    tx = random(floatround(floatsqroot(floatpower(minx-maxx,2)))+1)+minx;
    ty = random(floatround(floatsqroot(floatpower(miny-maxy,2)))+1)+miny;
}
The height can be found by MapAndreas or ColAndreas.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
https://sampforum.blast.hk/showthread.php?tid=591010

pawn Код:
// By AbyssMorgan
GetRandomPointInRectangle(Float:minx,Float:miny,Float:maxx,Float:maxy,&Float:tx,&Float:ty){
    tx = random(floatround(floatsqroot(floatpower(minx-maxx,2)))+1)+minx;
    ty = random(floatround(floatsqroot(floatpower(miny-maxy,2)))+1)+miny;
}
The height can be found by MapAndreas or ColAndreas.
Thanks a lot, I just have one more question regarding the z coord. Which of the two plugins are better? I've used MapAndreas and experienced issues with it setting the z coord to 0 in certain areas and I've never tried ColAndreas.
Reply
#4

Quote:
Originally Posted by DTV
Посмотреть сообщение
Thanks a lot, I just have one more question regarding the z coord. Which of the two plugins are better? I've used MapAndreas and experienced issues with it setting the z coord to 0 in certain areas and I've never tried ColAndreas.
ColAndreas is better use CA_FindZ_For2DCoord
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)