4 jail's random
#1

I have 4 jail's player poisition.
Its at SFPD interior and see there's 4 jail's.

But how i do make it takes player to 4 random jail's?

Police ---> /arrest [PLAYER] ---> PLAYER take'n to random (Takes one jail and he jailed in to or what ever)

[1 JAIL] [2 JAIL] [3 JAIL] [4 JAIL]
....^........^..........^..........^

System takes one jail then player will be into jail. Like 4 jail's random.

sorry for bad english.
Reply
#2

pretty much explains it:

https://sampwiki.blast.hk/wiki/Random
Reply
#3

I didn't see, thanks.
Reply
#4

Sorry, i need learn that random.

Код:
new Float:ArrestJail[4][1] = {
  {-2796.9854, 1224.8180, 20.5429},
  {-2454.2170, 503.8759, 30.0790},
  {-2669.7322, -6.0874, 6.1328},
  {345.2434, 23423.324234, 3432.3242}
}
Код:
suxxer = random(sizeof(ArrestJail));
SetPlayerPos(suspect, ArrestJail[suxxer][0], ArrestJail[suxxer][1], ArrestJail[suxxer][2], 0.0);
What mean is:
Код:
ArrestJail[suxxer][0]
Код:
ArrestJail[suxxer][1]
Код:
ArrestJail[suxxer][2]
And what is "[4][1] = {" ?
Код:
new Float:ArrestJail[4][1] = {
Reply
#5

you would need:

Код:
new Float:ArrestJail[4][1] = {
first [4] is the number of 'rows' (array's), the second [1] is the kind of numbers of fields per 'row'.

so it could be something like that:

Код:
new Float:ArrestJail[4][3] = {
  {-2796.9854, 1224.8180, 20.5429},
  {-2454.2170, 503.8759, 30.0790},
  {-2669.7322, -6.0874, 6.1328},
  {345.2434, 23423.324234, 3432.3242}
};
Код:
new rand = random(sizeof(ArrestJail)); //or suxxer ... ? :p
SetPlayerPos(playerid, ArrestJail[rand][0], ArrestJail[rand][1], ArrestJail[rand][2] ); //you set 'suspect' here instead of playerid, if suspect is defined as the playerid then you can use that, depends on where you calling this
//maybe a facing angle:
SetPlayerFacingAngle(playerid, 250); // you can set facing angle by adding a 4th 'field' in arrestjail... and call ArrestJail[rand][4] instead of 250...

Reply
#6

Thanks for helping
Reply
#7

sorry, corrected it: ArrestJail[rand][3] removed and forgot a ; after the float arrestjail...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)