[Halp] /hotwire
#1

So I have tried almost everything, but I cant get this command to start a vehicle, but not turn it off

Код:
CMD:hotwire(playerid, params[])
{
        if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You must be a driver to use this command.");
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
            HotWired[vehicle] = 1;
            SendClientMessage(playerid, GREY, "Now you can't turn off your car?");
        }
        return 1;
}
If someone could make it so that will turn on the engine, that would be great because it is not working.

Also, could someone make it is this command /e is only doable if you own the vehicle? I use AdvancedVehicleSystem, and I CAN NOT get it to work.

Код:
CMD:e(playerid, params[])
{
        if(GetPlayerState(playerid) != 2)return SendClientMessage(playerid, GREY, "You can't start a started car.");
        new vehicle = GetPlayerVehicleID(playerid);
        if(Engine[vehicle] == 0)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            Engine[vehicle] = 1;
            SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnet, boot, 0);
        }
        else if(Engine[vehicle] == 1)
        {
            new engine, lights, alarm, doors, bonnet, boot, objective;
            Engine[vehicle] = 0;
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnet, boot, 0);
        }
        return 1;
}
Thank you SA:MP community, you're awesome.
Reply
#2

For the hotwire command, you have this if(Engine[vehicle] == 1) meaning it'll check if the vehicle's engine is on before processing with the hotwire, wouldn't it be better to check if the vehicle is not running? if(Engine[vehicle] == 0)?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)