Vehicle health
#1

Hello guys, I'm used this code for set FACTION vehicle health,
pawn Код:
public OnVehicleSpawn(vehicleid)
 {
    for(new i; i < sizeof(LSPDVehicles); ++i)
{
    SetVehicleHealth(LSPDVehicles[i],2500.0);
}
How can I change this code for Model Vehicle, Like Patriot (ID 470) I want to set the health to 3000, So what I need to do?
Reply
#2

in your loop:

if(GetVehicleModel(vehicleid) == 470) SetVehicleHeal..... and so on
Reply
#3

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    for(new i; i < sizeof(LSPDVehicles); ++i)
    {
        if (GetVehicleModel(LSPDVehicles[i]) == 470) SetVehicleHealth(LSPDVehicles[i], 3000.0);
        else SetVehicleHealth(LSPDVehicles[i], 2500.0);
    }
    return 1;
}
Reply
#4

In my understand, you want to set the Patriot's vehicle health to 3000.0

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    for(new i; i < sizeof(LSPDVehicles); ++i)
    {
        return SetVehicleHealth(LSPDVehicles[i], 2500.0);
    }
    if(GetVehicleModel(vehicleid) == 470)
    {
        return SetVehicleHealth(vehicleid, 3000.0);
    }
    return true;
}
Reply
#5

Quote:
Originally Posted by pds2k12
Посмотреть сообщение
In my understand, you want to set the Patriot's vehicle health to 3000.0

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    for(new i; i < sizeof(LSPDVehicles); ++i)
    {
        return SetVehicleHealth(LSPDVehicles[i], 2500.0);
    }
    if(GetVehicleModel(vehicleid) == 470)
    {
        return SetVehicleHealth(vehicleid, 3000.0);
    }
    return true;
}
return SetVehicleHealth(LSPDVehicles[i], 2500.0);

Will break that loop.
Reply
#6

It's dont work for me.. Maybe anothers codes?
Reply
#7

Try this
pawn Код:
public OnVehicleSpawn(vehicleid)
{
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
    if(GetVehicleModel(vehicleid) == 470)
    {
    SetVehicleHealth(i, 3000);
    }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)