SA-MP Forums Archive
[HELP]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: [HELP]Random Spawns? (/showthread.php?tid=115877)



[HELP]Random Spawns? - bajskorv123 - 26.12.2009

Hey I was wondering how to make random spawns for dm area?

Heres my code:
Код:
// Minigun deathmatch
if(strcmp("/minidm",cmdtext,true)==0)
{
	SetPlayerInterior(playerid,57);
	SetPlayerVirtualWorld(playerid,57);
	AllowInteriorWeapons(true);
	ResetPlayerWeapons(playerid);
	GivePlayerWeapon(playerid,38,99999);
	return 1;
}
And heres the coords in the dm that i need random spawns for:
Код:
/*
// Random spawns
2641.8201, 2810.6196, 36.3222
2576.2593, 2703.4580, 22.9507
2524.1418, 2814.9497, 24.9536
2546.6863, 2753.8560, 10.8203
2617.7988, 2719.6909, 36.5386
2612.8235, 2658.6836, 37.8977
2685.6812, 2746.7214, 20.3222
*/
Thanks / Your homie Bajskorv123


Re: [HELP]Random Spawns? - patchkinson - 26.12.2009

top of your script

pawn Код:
new Float:RndSpawn[][4] =
 {
  {2641.8201, 2810.6196, 36.3222},
  {2576.2593, 2703.4580, 22.9507},
  {2524.1418, 2814.9497, 24.9536},
  {2546.6863, 2753.8560, 10.8203},
  {2617.7988, 2719.6909, 36.5386},
  {2612.8235, 2658.6836, 37.8977},
  {2685.6812, 2746.7214, 20.3222}

 }

and under the /minidm command
pawn Код:
new iRandom = random(sizeof(RndSpawn));
  SetPlayerPos(playerid, RndSpawn[iRandom][0], RndSpawn[iRandom][1],RndSpawn[iRandom][2]);
  SetPlayerFacingAngle(playerid, RndSpawn[iRandom][3]);
  return 1;
btw i had to check the wiki for most of the scripts, i dont use rands normally


[SOLVED]Random Spawns? - bajskorv123 - 26.12.2009

Thanks it works now Admin may lock topic