24.06.2011, 18:29
(
Последний раз редактировалось Christian_Bojic; 24.06.2011 в 18:30.
Причина: error in title
)
how to create random spawn?
new Float:RandomSpawn[][4] =
{
// Positions, (X, Y, Z and Facing Angle)
{-2796.9854, 1224.8180, 20.5429, 192.0335},
{-2454.2170, 503.8759, 30.0790, 267.2932},
{-2669.7322, -6.0874, 6.1328, 89.8853}
};
public OnPlayerSpawn(playerid)
{
new rand = random(sizeof(RandomSpawn));
// SetPlayerPos to the random spawn data
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
// SetPlayerFacingAngle to the random facing angle data
SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
return 1;
}
new Float:RandomSpawn[][4] =
{
// add your own co-ords and facing angles here
{-2796.9854, 1224.8180, 20.5429, 192.0335},
{-2454.2170, 503.8759, 30.0790, 267.2932},
{-2669.7322, -6.0874, 6.1328, 89.8853}
};
new rand = random(sizeof(RandomSpawn));
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
return 1;
new Float:RandomSpawn[][4] =
{
// add your own co-ords and facing angles here
{-2796.9854, 1224.8180, 20.5429, 192.0335},
{-2454.2170, 503.8759, 30.0790, 267.2932},
{-2669.7322, -6.0874, 6.1328, 89.8853}
};
new rand = random(sizeof(RandomSpawn));
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
return 1;
but I again dont understand, I know where to set it, but I dont know how to set spawn place
pawn Код:
pawn Код:
|
{-2796.9854, 1224.8180, 20.5429, 192.0335},
RandomSpawn[rand][0]
{-2796.9854, 1224.8180, 20.5429, 192.0335},
RandomSpawn[rand][1]
{-2454.2170, 503.8759, 30.0790, 267.2932},
RandomSpawn[rand][2]
{-2669.7322, -6.0874, 6.1328, 89.8853}
{-2796.9854, 1224.8180, 20.5429, 192.0335},
{-2454.2170, 503.8759, 30.0790, 267.2932},
{-2669.7322, -6.0874, 6.1328, 89.8853}
{-2796.9854, 1224.8180, 20.5429, 192.0335},
{-2454.2170, 503.8759, 30.0790, 267.2932},
{-3784.2170, 503.8759, 30.0790, 267.2932},
{-2669.7322, -6.0874, 6.1328, 89.8853}
RandomSpawn[rand][3]
RandomSpawn[rand][4]
ooo thanks man, my general question is what is, randomspawn[rand] xD
|
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
omg
E:\SErver\gamemodes\SFRJ.pwn(104) : error 017: undefined symbol "RandomSpawn" E:\SErver\gamemodes\SFRJ.pwn(104) : error 029: invalid expression, assumed zero E:\SErver\gamemodes\SFRJ.pwn(104) : warning 215: expression has no effect E:\SErver\gamemodes\SFRJ.pwn(106) : error 017: undefined symbol "RandomSpawn" E:\SErver\gamemodes\SFRJ.pwn(106) : warning 215: expression has no effect E:\SErver\gamemodes\SFRJ.pwn(106) : error 001: expected token: ";", but found "]" E:\SErver\gamemodes\SFRJ.pwn(106) : error 029: invalid expression, assumed zero E:\SErver\gamemodes\SFRJ.pwn(106) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 6 Errors. help |