Vehicle respawn disabled
#1

Hi! I'm working on a vehicle system and I'm trying to make it to where when the vehicle explodes, it doesn't respawn. Thanks for any help.
Reply
#2

When the vehicle health gets to 1, just destroy the vehicle.
Reply
#3

Soo...?
pawn Код:
public OnPlayerUpdate(playerid)
{
     new Float:health;
     for(new i=0; i<MAX_VEHICLES; i++)
     {
         GetVehicleHealth(i, health);
         if(health < 1) DestroyVehicle(i);
     }
}
Reply
#4

Something along the lines of that, although for efficiency, I recommend creating a timer instead of using OnPlayerUpdate as that is called wayyyy too many times a second.
Reply
#5

Ok, thanks. I agree with you. I realized that that was stupid after I hit post. haha Thanks for your help.
Reply
#6

Quote:
Originally Posted by Noah_Roufus
Посмотреть сообщение
Ok, thanks. I agree with you. I realized that that was stupid after I hit post. haha Thanks for your help.
You got the point of my post, nonetheless. Oh, and not a problem.
Reply
#7

OK, I have this. It still doesn't destroy the vehicles. Any advice?

pawn Код:
forward DestroyDeadVehicles();

public OnGameModeInit()
{  
    SetTimer("DestroyDeadVehicles", 2000, true);
}

public DestroyDeadVehicles()
{
    new Float:health;
    for(new i=0; i<MAX_VEHICLES; i++)
    {
        GetVehicleHealth(i, health);
        if(health <= 1) DestroyVehicle(i);
    }
    return 1;
}
Reply
#8

Hmm, I'm thinking the vehicle starts to flame at a higher health than 1, so check the wiki and see which health amount sets the vehicle on fire, and put it a little higher than that.
Reply
#9

pawn Код:
forward DestroyDeadVehicles();

public OnGameModeInit()
{  
    SetTimer("DestroyDeadVehicles", 2000, true);
}

public DestroyDeadVehicles()
{
    new Float:health;
    for(new i=0; i<MAX_VEHICLES; i++)
    {
        GetVehicleHealth(i, health);
        if(health <= 251) DestroyVehicle(i);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)