SA-MP Forums Archive
Destroy Vehicle - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Destroy Vehicle (/showthread.php?tid=86299)



Destroy Vehicle - DevilRevenge - 13.07.2009

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!


Re: Destroy Vehicle - Abernethy - 13.07.2009

Umm, DestroyVehicle(playerid); ?


Re: Destroy Vehicle - DevilRevenge - 13.07.2009

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


Re: Destroy Vehicle - saiberfun - 13.07.2009

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]);