Quick question. - 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: Quick question. (
/showthread.php?tid=207459)
Quick question. -
Haydz - 06.01.2011
How could i go about setting another players pos based on which cage the player got put in.
example - Player1 gets put in cage1, so player2 would also get put in cage1, if player happened to spawn in cage3, player2 would also spawn in cage3 etc etc.
Thanks in advance.
i tryed this.
pawn Код:
new Float:DuelSpawn[][4] =
{
{-1988.9508, 396.3534, 38.6947, 93.1988}, //cage 1 - if the player randomly gets spawned in here, it will put the other player to spawn in this cage also.
{-1962.7333, 394.0844, 38.6947, 92.2355}, //cage 2 - same as above
{-1962.9875, 378.6306, 38.6947, 88.5222}, //cage 3 -same as above
{-1988.8269, 370.3514, 38.6947, 96.6222} //cage 4 - same as above
};
//This is what i tryed but knew it wouldn't work out.
new rand = random(sizeof(DuelSpawn));
if(rand == 1) cage1[playerid] = 1; //if the player gets put in cage 1, the other player will spawn in cage 1
if(rand == 2) cage2[playerid] = 1; - as above
if(rand == 3) cage3[playerid] = 1; - as above
if(rand == 4) cage4[playerid] = 1; - as above
SetPlayerPos(playerid, DuelSpawn[rand][0], DuelSpawn[rand][1],DuelSpawn[rand][2]);
SetPlayerFacingAngle(playerid, DuelSpawn[rand][3]);
if(cage1[playerid] == 1) SetPlayerPos(giveplayerid, -1980.2439,396.1422,38.6947); //will put the other player in cage1 if the first player got spawned in cage 1
if(cage2[playerid] == 1) SetPlayerPos(giveplayerid, -1953.0988,394.8125,38.6947);
if(cage3[playerid] == 1) SetPlayerPos(giveplayerid, -1953.3700,378.1370,38.6947);
if(cage4[playerid] == 1) SetPlayerPos(giveplayerid, -1979.6733,371.4133,38.6947);
Re: Quick question. -
Joe Staff - 06.01.2011
pawn Код:
new Float:DuelSpawn[][4] =
{
{-1988.9508, 396.3534, 38.6947, 93.1988}, //cage 1 - if the player randomly gets spawned in here, it will put the other player to spawn in this cage also.
{-1962.7333, 394.0844, 38.6947, 92.2355}, //cage 2 - same as above
{-1962.9875, 378.6306, 38.6947, 88.5222}, //cage 3 -same as above
{-1988.8269, 370.3514, 38.6947, 96.6222} //cage 4 - same as above
};
new rand=random(sizeof(DuelSpawn));
SetPlayerPos(playerid,DuelSpawn[rand][0],DuelSpawn[rand][1],DuelSpawn[rand][2]);
SetPlayerPos(giveplayerid,DuelSpawn[rand][0],DuelSpawn[rand][1],DuelSpawn[rand][2]);
SetPlayerFacingAngle(playerid,DuelSpawn[rand][3]);
SetPlayerFacingAngle(giveplayerid,DuelSpawn[rand][3]);
Re: Quick question. -
Haydz - 06.01.2011
You sure?, looks like that would randomly put players inside 2 cages and they wouldn't get the same cage most the time.
Re: Quick question. -
Joe Staff - 06.01.2011
I'm sure, rand is choosing what cage, it's only random once, so every time after it's been set it will be the same number
Re: Quick question. -
Haydz - 06.01.2011
Alright cheers man, Thanks for the explaining it.