[Pedido] Spawn Aleatorio !
#1

Boas Pessoal, queria fazer 1 pedido ...
Alguem me pode fazer 1 codigo de spawn aleatorios?
Estou com alguma dificuldade a fazer isso ainda rsrs...
Reply
#2

Код:
stock SpawnEx(playerid)
{
	new Float:Spw_[][] =
	{
		{0.0, 0.0, 0.0},
		{0.0, 0.0, 0.0},
		{0.0, 0.0, 0.0}
	};
	
	SetPlayerPos(playerid, Spw_[0][random(sizeof(Spw_))], Spw_[1][random(sizeof(Spw_))], Spw_[2][random(sizeof(Spw_))]);
	
	return true;
}
Reply
#3

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Код:
stock SpawnEx(playerid)
{
	new Float:Spw_[][] =
	{
		{0.0, 0.0, 0.0},
		{0.0, 0.0, 0.0},
		{0.0, 0.0, 0.0}
	};
	
	SetPlayerPos(playerid, Spw_[0][random(sizeof(Spw_))], Spw_[1][random(sizeof(Spw_))], Spw_[2][random(sizeof(Spw_))]);
	
	return true;
}
Valeu
Reply
#4

Se este code nгo funfar, tente este, pois eu nгo posso testб-lo:

Код:
stock SpawnEx(playerid)
{
	new Float:Spw_[][] =
	{
		{0.0, 0.0, 0.0},
		{0.0, 0.0, 0.0},
		{0.0, 0.0, 0.0}
	};
	
	SetPlayerPos(playerid, Spw_[random(sizeof(Spw_))][0], Spw_[random(sizeof(Spw_))][1], Spw_[random(sizeof(Spw_))][2]);
	
	return true;
}
Reply
#5

Код:
stock SpawnEx(playerid)
{
	static const Float:Spw_[2][3] =
	{
		{0.0, 0.0, 0.0},
		{0.0, 0.0, 0.0},
		{0.0, 0.0, 0.0}
	};
	new rand = random(sizeof(Spw_));
	SetPlayerPos(playerid, Spw_[rand][0], Spw_[rand][1], Spw_[rand][2]);
	return true;
}
Reply
#6

new Float:Spawns[][4] = {
{0,0,0},
};
em onplayerspawn
new rand = random(sizeof(Spawns));
SetPlayerPos(playerid, Spawns[rand][0], Spawns[rand][1], Spawns[rand][2]);
SetPlayerFacingAngle(playerid,Spawns[rand][3]);

}
Reply
#7

Quote:
Originally Posted by PacManBRsPWN
Посмотреть сообщение
new Float:Spawns[][4] = {
{0,0,0},
};
em onplayerspawn
new rand = random(sizeof(Spawns));
SetPlayerPos(playerid, Spawns[rand][0], Spawns[rand][1], Spawns[rand][2]);
SetPlayerFacingAngle(playerid,Spawns[rand][3]);

}
Vai dar erro e aviso esse trem aн!
1- declarou em float mas o formato estб como inteiro;
2- nгo vai virgula nesta array;
Reply
#8

Tente esse

Quote:

new Float:SpawnA[][3] =
{
{Coordenada X,Coordenada Y, Coordenada Z},
{Coordenada X,Coordenada Y, Coordenada Z}

};

public OPlayerSpawn(playerid)
{
new rand = random(sizeof(SpawnA));
SetPlayerPos(playerid, SpawnA[rand][0], SpawnA[rand][1], SpawnA[rand][2]);
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)