SA-MP Forums Archive
Help cells. - 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: Help cells. (/showthread.php?tid=529848)



Help cells. - Fjclip99 - 04.08.2014

So i am making a /arrest command and i have jail and 25 cells. I have coordinates of every cell and now i want when i type /arrest it puts them in a RANDOM cell.
I have the command all i need is to put playeer in a RANDOM cell.
Thanks.


Re: Help cells. - iFarbod - 04.08.2014

I First think this should be about cells, bits and binary. But it's about jailing, arrest, etc.

..

Make an array of jail cell spawn points, use random() to get a random position.


Re: Help cells. - McBan - 04.08.2014

Something like this:

PHP код:
new Float:RandomCell[][] = 
{
    {
xyzrotation}, // Cell 1
    
{xyzrotation}, // Cell 2
    
{xyzrotation}, // Cell 3
    
{xyzrotation}, // Cell 4
    
{xyzrotation}, // Cell 5
    
{xyzrotation}, // Cell 6
    
{xyzrotation}, // Cell 7
    
{xyzrotation}, // Cell 8
    
{xyzrotation}, // Cell 9
    
{xyzrotation// Cell 10
    
{xyzrotation}, // Cell 11
    
{xyzrotation}, // Cell 12
    
{xyzrotation}, // Cell 13
    
{xyzrotation}, // Cell 14
    
{xyzrotation}, // Cell 15
    
{xyzrotation}, // Cell 16
    
{xyzrotation}, // Cell 17
    
{xyzrotation}, // Cell 18
    
{xyzrotation}, // Cell 19
    
{xyzrotation// Cell 20
    
{xyzrotation// Cell 21
    
{xyzrotation// Cell 22
    
{xyzrotation// Cell 23
    
{xyzrotation// Cell 24
    
{xyzrotation// Cell 25
}; 
Then put the code which is below in either the stock Arrest or the Arrest system, However you have done it.

PHP код:
    new Random random(sizeof(RandomCell));
    
SetPlayerPos(playeridRandomCell[Random][0], RandomCell[Random][1], RandomCell[Random][2]);
    
SetPlayerFacingAngle(playeridRandomCell[Random][3]);
    return 
1