02.04.2013, 12:24
Quote:
I'm pretty sure vehicles don't respond instantly, set it on a timer. Also, don't use MAX_PLAYERS + 1 and MAX_ARENACARS + 1 in your loops. It starts from 0.
|
pawn Код:
stock StartArena(arena)
{
//set game in progress
GameInProgress = 1;
//respawn cars
for(new i = 0; i < MAX_ARENACARS; i++)
{
SetVehicleToRespawn(ArenaCars[arena][i]);
//TEST
new test[128];
format(test, sizeof(test), "SetVehicleToRespawn(ArenaCars[%i][%i]);", arena, i);
SendClientMessageToAll(-1, test);
}
//put players in cars
for(new i = 0; i < MAX_PLAYERS; i++)
{
PutPlayerInVehicle(i, ArenaCars[arena][i], 0);
//TEST
new test[128];
format(test, sizeof(test), "PutPlayerInVehicle(%i, ArenaCars[%i][%i]", i, arena, i);
SendClientMessageToAll(-1, test);
}
}
pawn Код:
public OnGameModeInit()
{
//-----------^^OTHER CODE^^------------------
//---------------------------------------------------------------ARENAS
//arena parts
CreateObject(10394,3087.3999000,1427.6999500,22.9000000,0.0000000,0.0000000,0.0000000); //arena0
//arena cars
ArenaCars[0][1] = AddStaticVehicle(541,3108.8999000,1449.8000500,20.9000000,90.0000000,48,79); //arena_0_car1
ArenaCars[0][2] = AddStaticVehicle(541,3066.5000000,1449.5000000,20.9000000,270.0000000,48,79); //arena_0_car2
ArenaCars[0][3] = AddStaticVehicle(541,3066.3999000,1415.1999500,20.9000000,270.0000000,48,79); //arena_0_car3
ArenaCars[0][4] = AddStaticVehicle(541,3109.0996100,1416.8994100,20.9000000,90.0000000,48,79); //arena_0_car4
//arena barrels
CreateObject(1225,3099.3000500,1427.0000000,20.6000000,0.0000000,0.0000000,0.0000000); //arena_0_barrel1
CreateObject(1225,3099.1999500,1442.5000000,20.6000000,0.0000000,0.0000000,0.0000000); //arena_0_barrel2
CreateObject(1225,3079.5000000,1427.1992200,20.6000000,0.0000000,0.0000000,0.0000000); //arena_0_barrel3
CreateObject(1225,3078.2998000,1443.8994100,20.6000000,0.0000000,0.0000000,0.0000000); //arena_0_barrel4
//---------------------------------------------------------------ARENAS
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
SetTimerEx("StartArena", 5000, false, "i", 0);
return 1;
}
Код:
SetVehicleToRespawn(ArenaCars[0][0]); SetVehicleToRespawn(ArenaCars[0][1]); SetVehicleToRespawn(ArenaCars[0][2]); SetVehicleToRespawn(ArenaCars[0][3]); SetVehicleToRespawn(ArenaCars[0][4]); SetVehicleToRespawn(ArenaCars[0][5]); SetVehicleToRespawn(ArenaCars[0][6]); SetVehicleToRespawn(ArenaCars[0][7]); SetVehicleToRespawn(ArenaCars[0][8]); SetVehicleToRespawn(ArenaCars[0][9]);