[HELP]Random Spawns?
#1

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
Reply
#2

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
Reply
#3

Thanks it works now Admin may lock topic
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)