Totaled Scripts
#8

Personally, i'd use the method above by Alternative112

pawn Код:
new bool:disabled[MAX_VEHICLES];

public OnVehicleDamageStatusUpdate(vehicleid, playerid) {
    //Will ONLY trigger when the car takes physical damage (no bullets)
    new Float:vHealth;
    GetVehicleHealth(vehicleid, vHealth);
   
    if (health =< 300.0) {
        disabled[vehicleid] = true;
    }
   
    return 1;
}

CMD:engine(playerid, params) {
    //Do your validation stuff here
   
    if (disabled[GetPlayerVehicleID(playerid)]) {
        SendClientMessage(playerid, 0xCC0000FF, "The car's engine is too damaged to start!");
        //Anything else you want to do
    }
    else {
        //What to do when car is healthy
    }
    return 1;
}
Then use in place of the "anything else", SetVehicleParams. Kind of like this:

pawn Код:
new bool:disabled[MAX_VEHICLES];

public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
    new Float:vHealth;
    GetVehicleHealth(vehicleid, vHealth);
    if (health =< 300.0)
    {
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(vehicleid,0,0,0,0,0,0,objective);           
        disabled[vehicleid] = true;
    }
   
    return 1;
}

CMD:engine(playerid, params)
{
    if (disabled[GetPlayerVehicleID(playerid)]) return SendClientMessage(playerid, 0xCC0000FF, "The car's engine is too damaged to start!");
    else
    {
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(vehicleid,1, lights, alarm, doors, bonnet, boot, objective);
    }
    return 1;
}
So if the car gets damaged too much it'll disable everything, or set it to "off". EG: alarm off, doors closed, bonnet closed etc. Then when you type /engine to turn it back on, it'll check if its disabled. If it isnt, it'll start the engine

You may want to add this though for it to work:
pawn Код:
public OnGameModeInit()
{
    ManualVehicleEngineAndLights();
    return 1;
}
Reply


Messages In This Thread
Totaled Scripts - by Jizz - 17.06.2013, 01:37
Re: Totaled Scripts - by DobbysGamertag - 17.06.2013, 01:40
Re: Totaled Scripts - by Jizz - 17.06.2013, 03:27
Re: Totaled Scripts - by nmader - 17.06.2013, 03:38
Re: Totaled Scripts - by Alternative112 - 17.06.2013, 05:00
Re: Totaled Scripts - by Pottus - 17.06.2013, 05:59
Re: Totaled Scripts - by Alternative112 - 17.06.2013, 17:55
Re: Totaled Scripts - by DobbysGamertag - 18.06.2013, 02:50

Forum Jump:


Users browsing this thread: 1 Guest(s)