'RANDOM' Question
#1

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.
Reply
#2

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.
Reply
#3

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));
Reply
#4

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

Yes i did.

But I get:

warning 213: tag mismatch

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

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.
Reply
#7

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

XyZ -> rand[0],rand[1],rand[2]
Reply
#9

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]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)