Engine CMD is bugged
#1

pawn Код:
CMD:aengine(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SCM(playerid, -1, "You need to be the driver of the vehicle");
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
    if(IsAnOwnableCar(GetPlayerVehicleID(playerid)))
    {
        if(PlayerInfo[playerid][pPcarkey] == GetPlayerVehicleID(playerid) || PlayerInfo[playerid][pPcarkey2] == GetPlayerVehicleID(playerid))
        {
            if(engine == 1)
            {
                SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, lights, alarm, doors, bonnet, boot, objective);
                SCM(playerid, COLOR_LIGHTRED, "You have turned the engine off");
            }
            else if(engine == 0)
            {
                SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, lights, alarm, doors, bonnet, boot, objective);
                SCM(playerid, COLOR_LIGHTRED, "You have turned the engine on");
            }
            else
            {
                SCM(playerid, COLOR_LIGHTRED, "You do not have the keys to this vehicle. However, you may attempt to /hotwire it.");
            }
        }
    }
    return 1;
}
Whats wrong with this? It says i dont have the keys, even though that is my car id im in
Reply
#2

Try using this, it is not tested.

pawn Код:
CMD:aengine(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SCM(playerid, -1, "You need to be the driver of the vehicle");
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
    if(IsAnOwnableCar(GetPlayerVehicleID(playerid)))
    {
        if(PlayerInfo[playerid][pPcarkey] == GetPlayerVehicleID(playerid) || PlayerInfo[playerid][pPcarkey2] == GetPlayerVehicleID(playerid))
        {
            if(engine == 1)
            {
                SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0, lights, alarm, doors, bonnet, boot, objective);
                 SCM(playerid, COLOR_LIGHTRED, "You have turned the engine off");
            }
            else if(engine == 0)
            {
                SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, lights, alarm, doors, bonnet, boot, objective);
                SCM(playerid, COLOR_LIGHTRED, "You have turned the engine on");
            }
        }
        else
        {
            SCM(playerid, COLOR_LIGHTRED, "You do not have the keys to this vehicle. However, you may attempt to /hotwire it.");
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)