Seriously had enough of arrays now.
#4

I make something and I hope it works.
pawn Code:
new Float:cop_spawns[ 3 ][ ][ 4 ] =
{
    { // Los Santos
        {0.0, 0.0, 0.0, 0.0},
        {0.0, 0.0, 0.0, 0.0},
        {0.0, 0.0, 0.0, 0.0}
    }, // Los Santos
    { // San Fiero
        {0.0, 0.0, 0.0, 0.0},
        {0.0, 0.0, 0.0, 0.0},
        {0.0, 0.0, 0.0, 0.0}
    }, // San Fiero
    { // Las Venturas
        {0.0, 0.0, 0.0, 0.0},
        {0.0, 0.0, 0.0, 0.0},
        {0.0, 0.0, 0.0, 0.0}
    } // Las Venturas
};
And
pawn Code:
public OnPlayerSpawn( playerid )
{
    new cityrand = random( 3 );
    new rand = random( sizeof( cop_spawns ) );
    if( cityrand == 0 )
    {
        SetPlayerPos( playerid, cop_spawns[ cityrand ][ rand ][ 0 ], cop_spawns[ cityrand ][ rand ][ 1 ], cop_spawns[ cityrand ][ rand ][ 2 ] );
    }
    else if( cityrand == 1 )
    {
        SetPlayerPos( playerid, cop_spawns[ cityrand ][ rand ][ 0 ], cop_spawns[ cityrand ][ rand ][ 1 ], cop_spawns[ cityrand ][ rand ][ 2 ] );
    }
    else
    {
        SetPlayerPos( playerid, cop_spawns[ cityrand ][ rand ][ 0 ], cop_spawns[ cityrand ][ rand ][ 1 ], cop_spawns[ cityrand ][ rand ][ 2 ] );
    }
    return 1;
}
Or
pawn Code:
public OnPlayerSpawn( playerid )
{
    new cityrand = random( 3 );
    new rand = random( sizeof( cop_spawns ) );
    SetPlayerPos( playerid, cop_spawns[ cityrand ][ rand ][ 0 ], cop_spawns[ cityrand ][ rand ][ 1 ], cop_spawns[ cityrand ][ rand ][ 2 ] );
    return 1;
}
Reply


Messages In This Thread
Seriously had enough of arrays now. - by MP2 - 01.02.2012, 13:38
Re: Seriously had enough of arrays now. - by Konstantinos - 01.02.2012, 13:40
Re: Seriously had enough of arrays now. - by MP2 - 01.02.2012, 14:17
Re: Seriously had enough of arrays now. - by Konstantinos - 01.02.2012, 14:48
Re: Seriously had enough of arrays now. - by MP2 - 01.02.2012, 15:28
Re: Seriously had enough of arrays now. - by MP2 - 01.02.2012, 16:58
Re: Seriously had enough of arrays now. - by MP2 - 01.02.2012, 17:46

Forum Jump:


Users browsing this thread: 1 Guest(s)