26.11.2013, 16:55
pawn Код:
#include <a_samp>
#include <YSI\y_iterate>
public OnGameModeInit( )
{
SetTimer( "RandomCheckPoint" , 20000, true );
return true;
}
forward RandomCheckPoint( );
new Float:RandomCP[ ][ 4 ] = // change this to 4, number starts from 0 not 1
{
{ 2798.1702,-1576.2926,10.9272, 10.0 },
{ 2060.4375,-2091.2126,13.5469, 10.0 },
{ 070.8125,-2384.6160,13.5469, 10.0 },
{ 900.7358,-1204.0779,16.9832, 10.0 },
{ 800.1103,-1542.8258,13.5526, 10.0 }
};
public RandomCheckPoint()
{
foreach(Player, i)
{
if(!IsPlayerConnected(i)) continue;
new rand = random( sizeof( RandomCP ) );
SetPlayerCheckpoint( i, RandomCP[rand][0], RandomCP[rand][1], RandomCP[rand][2], RandomCP[rand][3] ); // this aswell
}
return 1;
}
Remember this, everyone you create an array it always STARTS at Null = 0