02.04.2013, 02:53
So, I have a function called StartArena(#); which when it is called, I want it to respawn the cars and put the players in their cars
That is what I have as the function. Below is some more code I have
How come when I spawn, it doesn't put me in the vehicle? BTW, I know that isn't the right spot to call StartArena, just using it as a test.
pawn Код:
stock StartArena(arena)
{
//set game in progress
GameInProgress = 1;
//respawn cars
for(new i = 0; i < MAX_ARENACARS+1; i++)
{
SetVehicleToRespawn(ArenaCars[arena][i]);
}
//put players in cars
for(new i = 0; i < MAX_PLAYERS+1; i++)
{
PutPlayerInVehicle(i, ArenaCars[arena][i], 0);
}
}
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)
{
StartArena(0);
return 1;
}