SA-MP Forums Archive
RANDOM POSITION ?? - 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)
+--- Thread: RANDOM POSITION ?? (/showthread.php?tid=228255)



RANDOM POSITION ?? - park4bmx - 19.02.2011

PROBLEM SOLVED 1 YEAR+ AGO, STOP BUMPING THIS THREAD

i got all this

pawn Код:
//At the top i got
new Float:RandomSpawn2[6][3] = {
{4505.9125976563,472.86169433594,34.201229095459},
{4467.1752929688,440.80676269531,34.886543273926},
{4484.0966796875,538.9677734375,52.043884277344},
{4456.326171875,495.46887207031,51.698280334473},
{4498.04296875,427.70236206055,34.49084854126},
{4373.0122070313,448.24356079102,34.037418365479}
};

//then later on i got
new rand = random(sizeof(RandomSpawn2));
SetPlayerPos(i, RandomSpawn2[rand][0], RandomSpawn2[rand][1], RandomSpawn2[rand][2]);



Re: RANDOM POSITION ?? - park4bmx - 19.02.2011

ok i simplified it ;p
I got the random pos but now i need each player to go to one of these random position


Re: RANDOM POSITION ?? - Outlaaw - 19.02.2011

try this
SetPlayerPos(i, RandomSpawn2[i][0], RandomSpawn2[i][1], RandomSpawn2[i][2]);

each playerid is different so they all have different lines from RandomSpawn
so u have 6 different pos atm


Re: RANDOM POSITION ?? - Mean - 19.02.2011

pawn Код:
new randspawn = random( 6 );
switch( randspawn )
{
    case 0: SetPlayerPos( i, 4505.9125976563,472.86169433594,34.201229095459 );
    case 1: SetPlayerPos( i, 4467.1752929688,440.80676269531,34.886543273926 );
    case 2: SetPlayerPos( i, 4484.0966796875,538.9677734375,52.043884277344 );
    case 3: SetPlayerPos( i, 4456.326171875,495.46887207031,51.698280334473 );
    case 4: SetPlayerPos( i, 4498.04296875,427.70236206055,34.49084854126 );
    case 5: SetPlayerPos( i, 4373.0122070313,448.24356079102,34.037418365479 );
}



Re: RANDOM POSITION ?? - dino_d_carter - 23.11.2012

Man change [i] to [playerid] i think it will work


Re: RANDOM POSITION ?? - park4bmx - 23.11.2012

Quote:
Originally Posted by dino_d_carter
Посмотреть сообщение
Man change [i] to [playerid] i think it will work
Why did you just bump 1 year old topic ?


AW: RANDOM POSITION ?? - Skimmer - 24.11.2012

Lol, too many noobs here.


Re: RANDOM POSITION ?? - dr.lozer - 24.11.2012

LOL! too many noobs XD

Dude, try this

pawn Код:
//At the top i got
new Float:RandomSpawn2[][] = { // <--------| dont add arrays. the system will define the arrays :D
{4505.9125976563,472.86169433594,34.201229095459},
{4467.1752929688,440.80676269531,34.886543273926},
{4484.0966796875,538.9677734375,52.043884277344},
{4456.326171875,495.46887207031,51.698280334473},
{4498.04296875,427.70236206055,34.49084854126},
{4373.0122070313,448.24356079102,34.037418365479}
};

//then later on i got
new rand = random(sizeof(RandomSpawn2));
/* if you use i for each players then use this
for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i)) */
// <----- dont forget to use this code
SetPlayerPos(playerid, RandomSpawn2[rand][0], RandomSpawn2[rand][1], RandomSpawn2[rand][2]);



Re: RANDOM POSITION ?? - park4bmx - 24.11.2012

let me quote my self again
Quote:
Originally Posted by park4bmx
Посмотреть сообщение
Why did you just bump 1 year old topic ?