Random Spawn - 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: Random Spawn (
/showthread.php?tid=169370)
Random Spawn -
bobintom - 19.08.2010
Can you tell me how i can do random spawns for a dm.
do when they tele to the dm some people start at different places to others.
Thanks
Re: Random Spawn -
ғαιιοцт - 19.08.2010
Код:
new rand = random(SPAWNPOINT_AMOUNT);
switch(rand)
{
case 0:
{
SetPlayerPos
SetPlayerFacingAngle
}
case 1:
{
SetPlayerPos
SetPlayerFacingAngle
}
...
}
Re: Random Spawn -
Hiddos - 19.08.2010
Fallout's way is an option, OR:
pawn Код:
new RandomSpawns[][4] = { // X - Y - Z- Angle
{1250.00000, -1250.00000, 50.00000, 360},
{180.00000, -30.00000, 2.00000, 300},
{1250.00000, -1250.00000, 3.50000, 20} //Add a new line for each new spawn position, the last line must be WITHOUT comma.
};
public OnPlayerSpawn(playerid)
{
new rand = random(sizeof(RandomSpawns));
SetPlayerPos(playerid, RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2]);
SetPlayerFacingAngle(playerid, RandomSpawns[rand][4]);
return 1;
}
Re: Random Spawn -
ғαιιοцт - 19.08.2010
Код:
SetPlayerFacingAngle(playerid, RandomSpawns[rand][3]);
not to show you you made a little mistake,
but to make sure the next question isn't:
I get error; how to fix it?