Random spawn in a square area - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Random spawn in a square area (
/showthread.php?tid=636727)
Random spawn in a square area -
KamoTo - 03.07.2017
Sup guys, i'm starting to make a GameMode but i'm stuck in this thing: I need to know how to create a random spawn in a square area, no saved positions but a square where random x,y and z are generated. So how can i do this ?
Re: Random spawn in a square area -
Toroi - 03.07.2017
This is pretty simple, you can just
PHP код:
SetPlayerPos(playerid,X+random(X1),Y+random(Y1),z)
Where X and Y is the starting point of your desired square and where (X + X1) and (Y + Y1) results in the ending point of your desired square.
Re: Random spawn in a square area -
KamoTo - 03.07.2017
Oh, thank you very much