SA-MP Forums Archive
why doesnt this code work? (reposted because of wrong section) - 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: why doesnt this code work? (reposted because of wrong section) (/showthread.php?tid=204092)



why doesnt this code work? (reposted because of wrong section) - Yourfatness - 28.12.2010

this code doesn't seem to do anything:
public OnVehicleDeath(vehicleid, killerid){
SetTimer("DestroyVehicle(vehicleid)",5000,false);
}

i've tried it with and without (vehicleid), yet it still does nothing. the car respawns and this code is useless.

using this code, i am able to get cars to disappear when their health hits 0, unfortuantely this also means that some cars disappear before they explode:
public OnVehicleDeath(vehicleid, killerid){
DestroyVehicle(vehicleid);
}

can anyone help me to make all (or most) cars explode when they are flipped over, but not respawn after?


Re: why doesnt this code work? (reposted because of wrong section) - WillyP - 28.12.2010

pawn Код:
public OnVehicleDeath(vehicleid, killerid){
SetTimer("DV",2000,false);
return 1;
}

forward DV(vehicleid);
public DV(vehicleid)
{
DestroyVehicle(vehicleid);
}



Re: why doesnt this code work? (reposted because of wrong section) - Hiddos - 28.12.2010

pawn Код:
forward DV(vehicleid);
public DV(vehicleid)
{
  DestroyVehicle(vehicleid);
}

public OnVehicleDeath(vehicleid, killerid)
{
  SetTimerEx("DV", 5000, 0 "i", vehicleid);
  return 1;
}
Should do the trick.


Re: why doesnt this code work? (reposted because of wrong section) - Yourfatness - 28.12.2010

thank you Hiddos. you are a badass. it works exactly as it should.

[FU]Victious, maybe you should test the code before posting it. if you had, you would know that it works like my code (it doesnt work).


Re: why doesnt this code work? (reposted because of wrong section) - _rAped - 28.12.2010

Quote:
Originally Posted by Yourfatness
Посмотреть сообщение
thank you Hiddos. you are a badass. it works exactly as it should.

[FU]Victious, maybe you should test the code before posting it. if you had, you would know that it works like my code (it doesnt work).
Hahaha. Okei you made me laugh by that comment x)


Re: why doesnt this code work? (reposted because of wrong section) - PowerPC603 - 28.12.2010

You don't need a timer for this.
Just put the DestroyVehicle statement under OnVehicleSpawn.
It won't get destroyed when you create it, but when a vehicle re-spawns (after dying for example).