SA-MP Forums Archive
Spawn in different places - 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: Spawn in different places (/showthread.php?tid=402163)



Spawn in different places - RiChArD_A - 25.12.2012

Hello, on my server the lpayer when dies, always returns the same place. I want that to varie. For example: I die now and I spawn in place "BLUE" then die again and spawn in place "RED"
(Blue and Red are just examples so they know they are two different places)


Re: Spawn in different places - David (Sabljak) - 25.12.2012

On top script

Код:
new BlueSpawn[3][PlayerSpawnInfo] = 
{
{X,Y,Z},
{X,Y,Z},
{X,Y,Z}
};
onplayerspawn
Код:
new rand = random(sizeof(BlueSpawn));
SetPlayerPos(playerid,BlueSpawn[rand][PlayerX],BlueSpawn[rand][PlayerY],BlueSpawn[rand][PlayerZ]);
i forgot this

Код:
enum PlayerSpawnInfo
{
	Float:PlayerX,
	Float:PlayerY,
	Float:PlayerZ
}
on top


Re : Spawn in different places - [HRD]Mar1 - 25.12.2012

look at this is very useful!
https://sampforum.blast.hk/showthread.php?tid=162488


Re: Spawn in different places - [HK]Ryder[AN] - 25.12.2012

The wiki for the function "random" has this as an example

https://sampwiki.blast.hk/wiki/Random