Destroy Vehicle
#1

Hello,
I'm doing a boat race.
After The finishing of the race,I want to destory the vehicle that I created before.

Код:
for(new i;i<MAX_PLAYERS;i++) {
if(InBoatRace[i] == 1) {
TogglePlayerControllable(i, 1);
for(new i;i<MAX_PLAYERS;i++)
{
if(InBoatRace[i] == 1) DestroyVehicle(GetPlayerVehicleID(i));
}

The vehicle doesnt destroy.
This is the creation of the vehicle:

Код:
new rand = random(sizeof(RandomRaceSpawns));
Car[i] = CreateVehicle(446,RandomRaceSpawns[rand][0],RandomRaceSpawns[rand][1],RandomRaceSpawns[rand][2],RandomRaceSpawns[rand][3],75,84,3000);
PutPlayerInVehicle(i,Car[i],0);
Thank you for helping!
Reply
#2

Umm, DestroyVehicle(playerid); ?
Reply
#3

But if there are many players?
I need to check each one if thay was in the race - if( InBoatRace[i]==1)
Reply
#4

pawn Код:
DestroyVehicle(car[playerid]);
but i guess that would only destroy the last created vehicle.
so u need to make new varibales for each playerid like

pawn Код:
new firstone;//ontopofscript
new secondone;//same
pawn Код:
//at creating the vehicle for the first racer
firstone = playerid;
//and the same for the secondracer
secondone = playerid;
then when u destroy the vehicles u do:
pawn Код:
DestroyVehicle(car[firstone]);
DestroyVehicle(car[secondone]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)