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



'RANDOM' Question - jaami - 02.04.2012

Hi, I'm confused with this. How do I add 'SetPlayerInterior' ?
I thought it would be SetPlayerInterior(playerid, Locations[rand][10]);
but doesn't work...


new Float:Locations[1][10] =
{
{-2174.5286,1724.5497,31.9492, -2160.3489,1715.1298,34.6726, -2174.5286,1724.5497,31.9492, 225.1787}
};



new rand = random(sizeof(Locations));
SetPlayerPos(playerid, Locations[rand][0], Locations[rand][1], Locations[rand][2]);
SetPlayerCameraPos(playerid, Locations[rand][3], Locations[rand][4], Locations[rand][5]);
SetPlayerCameraLookAt(playerid, Locations[rand][6],Locations[rand][7], Locations[rand][8]);
SetPlayerFacingAngle(playerid, Locations[rand][9]);


Sorry I can't turn it into 'code format' due to my net browser problem.


Re: 'RANDOM' Question - blank. - 02.04.2012

If I understood your post correctly, SetPlayerInterior refers to interior ID's employed by GTA SA, not vectors.
Let's go with 24/7 1 from the SA-MP wiki, to transport a player there you would do this:
SetPlayerInterior(playerid,17) // The interior used by the location
SetPlayerPos(playerid,-25.884499,-185.868988,1003.549988) // The vector for it
You need to store the interior ID per location.


Re: 'RANDOM' Question - jaami - 02.04.2012

lmao, I didn't ask for that. That was the first thing I learnt from sa:mp scripting.

I needed help with adding 'setplayerinterior' to the array. Under new rand = random(sizeof(Locations));


Re: 'RANDOM' Question - blank. - 02.04.2012

Have you tried adding the interior number at the very end(After 225) and adding SetPlayerInterior(playerid,Locations[rand][10])?


Re: 'RANDOM' Question - jaami - 02.04.2012

Yes i did.

But I get:

warning 213: tag mismatch

(The line is: SetPlayerInterior(playerid,Locations[rand][10])


Re: 'RANDOM' Question - [HiC]TheKiller - 02.04.2012

Quote:
Originally Posted by jaami
Посмотреть сообщение
Yes i did.

But I get:

warning 213: tag mismatch

(The line is: SetPlayerInterior(playerid,Locations[rand][10])
225.1787 is a co-ordinate(float) rather than a integer. That's what is in the 10th place in that array.


Re: 'RANDOM' Question - jaami - 02.04.2012

So what would SetPlayerInterior(playerid,Locations[rand][?]); be?


Re: 'RANDOM' Question - _DownLoaD_ - 02.04.2012

XyZ -> rand[0],rand[1],rand[2]


Re: 'RANDOM' Question - jaami - 02.04.2012

I did... But I still get tag mismatch.
Can someone please do it for me.

new Float:Locations[1][10] =
{
{-2174.5286,1724.5497,31.9492, -2160.3489,1715.1298,34.6726, -2174.5286,1724.5497,31.9492, 225.1787}
};


new rand = random(sizeof(Locations));
SetPlayerPos(playerid, Locations[rand][0], Locations[rand][1], Locations[rand][2]);
SetPlayerCameraPos(playerid, Locations[rand][3], Locations[rand][4], Locations[rand][5]);
SetPlayerCameraLookAt(playerid, Locations[rand][6],Locations[rand][7], Locations[rand][8]);
SetPlayerFacingAngle(playerid, Locations[rand][9]);
SetPlayerInterior(playerid, Locations[rand][10]);