Random Spawn Problema -
bruno_orlandi - 31.01.2011
Tenho 2 times com spawns aleatorios, mas sу os zumbis estгo nascendo aleatorio, pq?
pawn Код:
new Float:gHuman[][4] = {
(83.5795,-188.2310,1.5411,265.2881),
(84.0415,-149.5860,2.5844,266.0217),
(162.2956,-169.4884,1.5847,85.1454),
(156.2416,-186.0560,1.5781,354.9242),
(213.2995,-182.9630,1.5781,354.0457),
(207.0590,-112.1741,4.8965,91.4332),
(166.5871,-119.4537,1.5547,15.7618),
(207.2733,-62.0193,1.8948,179.1673),
(161.8962,-41.1162,1.5781,251.8404),
(202.2464,-34.3933,2.5703,358.4424),
(263.2441,21.9527,3.4332,284.1632),
(273.3023,0.3714,2.4340,6.9258),
(251.0288,-58.1501,1.5703,300.7580),
(295.3122,-55.5556,2.7772,81.9373),
(330.9281,-40.3541,2.2255,192.0412),
(344.5096,-71.6459,2.4308,174.1997),
(374.9836,-76.7144,1.3828,181.3658),
(313.3036,-121.1376,3.5354,270.4160),
(308.5240,-192.8339,1.5781,283.2847),
(273.1788,-195.3400,1.5705,261.4963)
};
new Float:gZombie[][4] = {
{-74.2471,-104.6387,3.1181,263.6816},
{-89.6150,-37.1434,3.1172,200.2368},
{-46.7918,32.4112,3.1172,222.5757},
{-44.6871,38.8143,3.6128,204.5483},
{-93.1227,-36.0042,2.7016,207.4023},
{318.3463,44.7995,2.6057,123.7158},
{300.1299,37.2024,2.2205,110.6408},
{322.1576,19.1469,4.4184,300.8496},
{344.4539,32.5035,5.9672,303.5466},
{326.2456,32.7645,5.9762,29.6991},
{312.4843,50.4846,2.5169,28.1484},
{283.7419,45.1142,2.1027,101.4422},
{255.9304,-277.4901,1.1621,93.9264},
{269.3267,-286.0890,1.1560,171.3017},
{263.4589,-296.7108,1.1559,103.0145},
{258.4813,-301.1730,1.1563,140.2336},
(89.9168,-291.0270,1.1624,346.8134)
};
pawn Код:
public OnGameModeInit()
{
// Human team
AddPlayerClass(7,0,0,0,0, 0, 0, 0, 0, 0, 0); // human
AddPlayerClass(17,0,0,0,0, 0, 0, 0, 0, 0, 0); // human
AddPlayerClass(20,0,0,0,0, 0, 0, 0, 0, 0, 0); // human
AddPlayerClass(23,0,0,0,0, 0, 0, 0, 0, 0, 0); // human
AddPlayerClass(46,0,0,0,0, 0, 0, 0, 0, 0, 0); // human
AddPlayerClass(47,0,0,0,0, 0, 0, 0, 0, 0, 0); // human
AddPlayerClass(48,0,0,0,0, 0, 0, 0, 0, 0, 0); // human
AddPlayerClass(60,0,0,0,0, 0, 0, 0, 0, 0, 0); // human
AddPlayerClass(72,0,0,0,0, 0, 0, 0, 0, 0, 0); // human
AddPlayerClass(101,0,0,0,0, 0, 0, 0, 0, 0, 0); // human
// Zombie team
AddPlayerClass(162,0,0,0,0, 0, 0, 0, 0, 0, 0); // zombie
return 1;
}
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
if(classid <= 9)
{
GameTextForPlayer(playerid, "~g~Human", 1000, 3);
gTeam[playerid] = TEAM_HUMAN;
}
else if(classid >= 10)
{
GameTextForPlayer(playerid, "~r~Zombie", 1000, 3);
gTeam[playerid] = TEAM_ZOMBIE;
}
return 1;
}
public OnPlayerSpawn(playerid)
{
if(gTeam[playerid] == TEAM_ZOMBIE)
{
new rands = random(sizeof(gZombie));
SetPlayerPos(playerid, gZombie[rands][0], gZombie[rands][1], gZombie[rands][2]);
SetPlayerFacingAngle(playerid, gZombie[rands][3]);
}
else if(gTeam[playerid] == TEAM_HUMAN)
{
new rands = random(sizeof(gHuman));
SetPlayerPos(playerid, gHuman[rands][0], gHuman[rands][1], gHuman[rands][2]);
SetPlayerFacingAngle(playerid, gHuman[rands][3]);
}
return 1;
}
Os humanos nascem na posiзгo x=0 y=0 z=0 e caindo no infinito, pq nao dгo spawn aleatуrio igual os zumbis?
Re: Random Spawn Problema -
ManoLexuS - 31.01.2011
Tente colocando isso:
pawn Код:
new Float:gHuman[20][4] = {
//as coords
//contei mais ou menos por alto... acho que sгo 20, caso for mais ou menos, altere ali em cima.
}
new Float:gZombie[17][4] = {
//as coords
//contei mais ou menos por alto... acho que sгo 17, caso for mais ou menos, altere ali em cima.
}
Caso nгo tenha entendido й sу falar.
Espero ter ajudado.
Re: Random Spawn Problema -
bruno_orlandi - 01.02.2011
Eu entendi, mas dб na mesma, os zumbis dгo spawn aleatoriamente como eu quero, mas os humanos nгo, pq os humanos nao dб certo?
Nгo tem nenhum outro setplayerpos no meu script, nem qualquer coisa q force outro spawn do player...
Respuesta: Random Spawn Problema -
ipsBruno - 01.02.2011
Eu nгo sei,mas tente:
pawn Код:
public OnPlayerSpawn(playerid)
{
if(gTeam[playerid] == TEAM_ZOMBIE)
{
new rands = random(sizeof(gZombie));
SetPlayerPos(playerid, gZombie[rands][0], gZombie[rands][1], gZombie[rands][2]);
SetPlayerFacingAngle(playerid, gZombie[rands][3]);
}
if(gTeam[playerid] == TEAM_HUMAN)
{
new rands = random(sizeof(gHuman));
SetPlayerPos(playerid, gHuman[rands][0], gHuman[rands][1], gHuman[rands][2]);
SetPlayerFacingAngle(playerid, gHuman[rands][3]);
}
return 1;
}
Re: Random Spawn Problema -
bruno_orlandi - 01.02.2011
ja tentei isso DraKiNs, mas continua mesma coisa
Re: Random Spawn Problema -
Ambrуsio - 01.02.2011
Pode с adiantar, mas с custa nada tentar:
pawn Код:
new Float:gHuman[][] = {
new Float:gZombie[][] = {