vehicle destroy +rep!
#1

hi,

how can i create a vehicle and let it diasappear when its destroyed?
Cause right now it always respawns after its destroyed.

please help
Reply
#2

You can do this;

pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    DestroyVehicle(vehicleid);
    printf("Vehicle %d was destroyed", vehicleid);
}
Hope I helped.
Reply
#3

The above will destroy every vehicle that dies though! Use a global variable to keep track of the vehicle that you wish to be destroyed when it dies, and add an if statement to the above poster's method. If you're planning on having multiple vehicles that get destroyed upon death, use an array/loop.
Reply
#4

But doesnt he want to disappear the vehicles after they are destroyed so why can't he use the code iGetty posted?
Reply
#5

That's exactly why I posted it.
Reply
#6

Look at his original message lol.

"how can i create a vehicle and let it diasappear when its destroyed?
Cause right now it always respawns after its destroyed."

He's asking about a single vehicle. iGetty's code would destroy every vehicle on the server that dies. This isnt ideal if your only looking to do that for a single vehicle, or even a selected few vehicles! Im not sure what he's trying to accomplish through this, but picture a big server with lots of vehicles placed. Lets say this server wanted to make a (badly coded) vehicle purchaser and decided to just let the vehicles exist until they die, where they would then be destroyed so they dont respawn where they were purchased. Destroying every vehicle on death would accomplish this task, but it would also destroy every other vehicle that dies.

IF thats what he was asking for, i misunderstood due to the wording (sorry), and iGetty's code should be used without the if statements in that case.
Reply
#7

I have to add to this. He is trying to say that his vehicles are re spawning when he wants them destroyed I think you check how you are loading your vehicles. Do you load via CreateVehicle?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)