SA-MP Forums Archive
Random spawns - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Random spawns (/showthread.php?tid=93437)



Random spawns - _Vortex - 25.08.2009

Hello,

How do I make it so when someone joins and they pick a skin or when they die it spawns them at a random position that I make?

Thanks


Re: Random spawns - [LSB]Clinz - 25.08.2009

Top of the script:

Код:
new Float: RandomSpawns[3][] = {
{X,Y,Z},
{X,Y,Z},
{X,Y,Z}
};
The cell-number (which has a value of 3 currently), changes on an accord of how many sets of co-ordinates you put in there. Change the X,Y,Z as well, obviously.

Код:
public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid,RandomSpawns[random(3)]);
return 1;
}
I'm not sure, that might work.


Re: Random spawns - landapanda - 25.08.2009

This is what i use: (and it works perfectly, for me anyway)
Код:
public OnPlayerSpawn(playerid)
{
  new rand;
	rand = random(5);
	rand++; 
	switch(rand)
	{
	case 1: { SetPlayerPos(playerid, X,Y,Z); SetPlayerFacingAngle(playerid, Angle); SetCameraBehindPlayer(playerid);}
	case 2: { SetPlayerPos(playerid, X,Y,Z); SetPlayerFacingAngle(playerid, Angle); SetCameraBehindPlayer(playerid);}
	case 3: { SetPlayerPos(playerid, X,Y,Z); SetPlayerFacingAngle(playerid, Angle); SetCameraBehindPlayer(playerid);}
	case 4: { SetPlayerPos(playerid, X,Y,Z); SetPlayerFacingAngle(playerid, Angle); SetCameraBehindPlayer(playerid);}
	case 5: { SetPlayerPos(playerid, X,Y,Z); SetPlayerFacingAngle(playerid, Angle); SetCameraBehindPlayer(playerid);}
	}
	return 1;
}



Re: Random spawns - _Vortex - 25.08.2009

Clinz,

I get these errors:

Код:
C:\Users\Damien\Desktop\samp server\gamemodes\deathhour.pwn(14) : error 018: initialization data exceeds declared size
C:\Users\Damien\Desktop\samp server\gamemodes\deathhour.pwn(65) : error 010: invalid function or declaration
C:\Users\Damien\Desktop\samp server\gamemodes\deathhour.pwn(117) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
http://pastebin.com/mfb928b3


Re: Random spawns - refshal - 25.08.2009

Here, pastebin.com/fec18517, use this...


Re: Random spawns - _Vortex - 25.08.2009

Quote:
Originally Posted by еddy
Here, pastebin.com/fec18517, use this...
Thanks