15.06.2009, 13:04
I make area with minx, maxx, miny, maxy. How to make random spawn in that area? Spawn anywhere in that area?
new c = random(12)+1; //creates a random number from 0 to 12
switch (c)
{
case 0:{SetPlayerPos(playerid,286.9416,1410.9337,10.3947);}
case 1:{SetPlayerPos(playerid,286.9416,1410.9337,10.3947);}
case 2:{SetPlayerPos(playerid,215.0739,1411.1678,10.5859);}
case 3:{SetPlayerPos(playerid,111.3430,1410.3840,10.6022);}
case 4:{SetPlayerPos(playerid,189.9601,1483.5343,10.5859);}
case 5:{SetPlayerPos(playerid,205.5110,1347.1440,10.5859);}
case 6:{SetPlayerPos(playerid, 215.0226,1466.8556,23.7344);}
case 7:{SetPlayerPos(playerid,246.6161,1361.7271,23.3703);}
case 8:{SetPlayerPos(playerid, 246.3493,1435.4602,23.3750);}
case 9:{SetPlayerPos(playerid, 215.0226,1466.8556,23.7344);}
case 10:{SetPlayerPos(playerid, 187.6121,1371.7318,23.7344);}
case 11:{SetPlayerPos(playerid, 187.6121,1371.7318,23.7344);}
case 12:{SetPlayerPos(playerid, 246.6161,1361.7271,23.3703);}
}
SetPlayerPos(
random(maxx-minx)+minx,
random(maxy-miny)+minz,
z
);
Originally Posted by yezizhu
pawn Код:
|
SetPlayerPos(
random(maxx-minx)+minx,
random(maxy-miny)+minz, // +miny here i think :)
z
);