24.01.2012, 18:38
This works. I tested it on localhost. However, your compiler crashed because you used random from the Spawns that they were 5 and you used 4.
Also, random 4 in what?
That isn't correct. We want random Spawns from the Global variables.
Also, random 4 in what?
pawn Код:
new rand = random(4);
pawn Код:
// At The Top
new Float:SpawnsCivilian[ ][ 4 ] =
{
{-2051.7437,478.5006,35.1723,261.2405},
{-2036.9413,1194.0226,45.4453,165.4971},
{-1770.8910,1202.6089,25.1250,192.7926},
{-1551.7037,1165.8408,7.1875,56.0145}
};
new Float:SpawnsCops[ ][ 4 ] =
{
{-1624.7889,661.7517,-5.2422,15.6977},
{-1598.7067,679.4637,-5.2422,1.2324},
{-1614.2136,732.3307,-5.2422,359.9951},
{-1620.7598,685.4606,7.1901,190.0825}
};
public OnPlayerSpawn( playerid )
{
new
rand = random( sizeof( SpawnsCivilian) ),
rand2 = random( sizeof( SpawnsCops) );
if( gTeam[ playerid ] == COP )
{
SetPlayerPos( playerid, SpawnsCops[ rand ][ 0 ], SpawnsCops[ rand ][ 1 ],SpawnsCops[ rand ][ 2 ] );
SetPlayerFacingAngle( playerid, SpawnsCops[ rand ][ 3 ] );
}
if( gTeam[ playerid ] == CIV )
{
SetPlayerPos( playerid, SpawnsCivilian[ rand2 ][ 0 ], SpawnsCivilian[ rand2 ][ 1 ], SpawnsCivilian[ rand2 ][ 2 ] );
SetPlayerFacingAngle( playerid, SpawnsCivilian[ rand ][ 3 ] );
}
return 1;
}