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



Checkpoint - StrikerZ - 14.05.2017

So, I want to make some random checkpoints out of variable. A random checkpoint to a business location.
PHP код:
for(new b=0;b<MAX_STORES;b++) if(stores[b][savings] == 1)
    {
        
stores[b][sx],stores[b][sy],stores[b][sz//To do [random checkpoint]
    

Got any idea? To set a random checkpoint to any business's location.


Re: Checkpoint - Bolex_ - 14.05.2017

Something like ?

pawn Код:
new Float: b_Checkpoints[ ][ 3 ] =
{
    { 0.0, 0.0, 0.0 },
    { 0.0, 0.0, 0.0 },
    { 0.0, 0.0, 0.0 },
    { 0.0, 0.0, 0.0 },
    { 0.0, 0.0, 0.0 }
};

new rand = random( sizeof( b_Checkpoints ) );
SetPlayerCheckpoint( playerid,  stores[b][sx],stores[b][sy],stores[b][sz], 2.0 );



Re: Checkpoint - StrikerZ - 14.05.2017

Well I figured it out.
PHP код:
new count;
for(new 
0;i<MAX_STORES;i++) if(stores[i][savings] == 1)
{
        
count++;
}
new 
random(count);
SetPlayerCheckpointplayerid,  stores[b][sx],stores[b][sy],stores[b][sz], 2.0 );