[Question] Unknown Command
#1

Hey guys,

I just noticed on thing on my Server.
If a player has a vehicle above ID 800 and attemts to start his/her vehicle with the /engine command you get a message saying "Unkown command"

If I'm not incorrect the limit are on 2000 vehicles on the server.
I check the command to start the engine and cant find any problem with it.
Anyone have and Idea of what the problem can be?

This is the command
pawn Код:
if(strcmp(cmd, "/engine", true) == 0)//start
    {
        if(IsPlayerConnected(playerid))
        {
                new VID;
                VID = GetPlayerVehicleID(playerid);
                //new idcar = GetPlayerVehicleID(playerid);
                if(CarRunning[VID] == 0)
                {
                    if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
                    {
                        return 1;
                    }
                    if(IsASalesVehicle(VID))
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "[INFO]  - You can not take a vehicle from one of the Dealership's");
                        return 1;
                    }
                    if(IsAHarvester(VID))
                    {
                        if(PlayerInfo[playerid][pJob] == 21)
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "   %s has attempted to Start the vehicle", sendername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            printf("%s", string);
                            EnterCarTime[playerid] += 1;
                        }
                        return 1;
                    }
                    if(IsAnOwnableCar(VID))
                    {
                        if(PlayerInfo[playerid][pPcarkey] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey2] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey3] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey4] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey5] == VID) { }
                        else
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "* %s rips off the ignition cover.", sendername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            EnterCarTimeH[playerid] += 1;
                            return 1;
                        }
                    }
                    if(IsATaxi(VID))
                    {
                        if(PlayerInfo[playerid][pJob] == 14)
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "   %s has attempted to Start the vehicle", sendername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            printf("%s", string);
                            EnterCarTime[playerid] += 1;
                        }
                        return 1;
                    }
                    if(VID >= 1 && VID <= 20)
                    {
                        if(HireCar[playerid] != VID)
                        {
                            return 1;
                        }
                    }
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "   %s has attempted to Start the vehicle", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    printf("%s", string);
                    EnterCarTime[playerid] += 1;
                    return 1;
                }
                else if(CarRunning[VID] == 1)
                {
                    if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
                    {
                        return 1;
                    }
                    if(IsAnOwnableCar(VID))
                    {
                        if(PlayerInfo[playerid][pPcarkey] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey2] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey3] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey4] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey5] == VID) { }
                        else { return 1; }
                    }
                    if(IsATaxi(VID))
                    {
                        if(PlayerInfo[playerid][pJob] == 14)
                        {
                            GetPlayerName(playerid,sendername,sizeof(sendername));
                            format(string, sizeof(string), "** %s Turns Their Car off.",sendername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            new engine,lights,alarm,doors,bonnet,boot,objective;
                            GetVehicleParamsEx(VID,engine,lights,alarm,doors,bonnet,boot,objective);
                            SetVehicleParamsEx(VID,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                            CarRunning[VID] = 0;
                        }
                        return 1;
                    }
                    if(VID >= 1 && VID <= 20)
                    {
                        if(HireCar[playerid] != VID)
                        {
                            return 1;
                        }
                    }
                    GetPlayerName(playerid,sendername,sizeof(sendername));
                    format(string, sizeof(string), "** %s Turns Their Car off.",sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    new engine,lights,alarm,doors,bonnet,boot,objective;
                    GetVehicleParamsEx(VID,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(VID,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                    CarRunning[VID] = 0;
                }
                else
                {
                SendClientMessage(playerid, COLOR_GREY, " You are not in a car !");
                return 1;
            }
        }
    }
Followed by this code
pawn Код:
if(EnterCarTimeH[i] >= 1)//start
            {
                EnterCarTimeH[i] += 1;
                VID = GetPlayerVehicleID(i);
                GetVehicleHealth(VID, Vehhp);
                if(EnterCarTimeH[i] == 3)
                {
                    //GetPlayerName(i, sendername, sizeof(sendername));
                    format(string, sizeof(string), "*  %s has attempted to Start the vehicle", GetPlayerNameEx(i));
                    ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    EnterCarTimeH[i] = 0;
                    EnterCarTime[i] += 1;
                }
            }
            if(EnterCarTime[i] >= 1)//start
            {
                EnterCarTime[i] += 1;
                VID = GetPlayerVehicleID(i);
                GetVehicleHealth(VID, Vehhp);
                if(EnterCarTime[i] == 3)
                {
                    if(CarWires[VID] == 0 && Vehhp > 400 && Gas[VID] > 3)
                    {
                        new engine,lights,alarm,doors,bonnet,boot,objective;
                        SendClientMessage(i, TEAM_GROVE_COLOR, "   The engine is now running, Drive Safely");
                        GetVehicleParamsEx(VID,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(VID,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                        //TogglePlayerControllable(i, 1);
                        CarRunning[VID] = 1;
                        EnterCarTime[i] = 0;
                    }
                    else
                    {
                        new engine,lights,alarm,doors,bonnet,boot,objective;
                        SendClientMessage(i, COLOR_RED,"   You failed to start your car !");
                        SendClientMessage(i, COLOR_RED, "   Check your Gauges !");
                        GetVehicleParamsEx(VID,engine,lights,alarm,doors,bonnet,boot,objective);
                        SetVehicleParamsEx(VID,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                        EnterCarTime[i] = 0;
                    }
                }
            }
Thanks for all Help!
Reply
#2

pawn Код:
if(strcmp(cmd, "/engine", true) == 0)//start
    {
        if(IsPlayerConnected(playerid))
        {
                new VID;
                VID = GetPlayerVehicleID(playerid);
                //new idcar = GetPlayerVehicleID(playerid);
                if(CarRunning[VID] == 0)
                {
                    if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
                    {
                        return 1;
                    }
                    if(IsASalesVehicle(VID))
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "[INFO]  - You can not take a vehicle from one of the Dealership's");
                        return 1;
                    }
                    if(IsAHarvester(VID))
                    {
                        if(PlayerInfo[playerid][pJob] == 21)
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "   %s has attempted to Start the vehicle", sendername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            printf("%s", string);
                            EnterCarTime[playerid] += 1;
                        }
                        return 1;
                    }
                    if(IsAnOwnableCar(VID))
                    {
                        if(PlayerInfo[playerid][pPcarkey] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey2] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey3] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey4] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey5] == VID) { }
                        else
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "* %s rips off the ignition cover.", sendername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            EnterCarTimeH[playerid] += 1;
                            return 1;
                        }
                    }
                    if(IsATaxi(VID))
                    {
                        if(PlayerInfo[playerid][pJob] == 14)
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "   %s has attempted to Start the vehicle", sendername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            printf("%s", string);
                            EnterCarTime[playerid] += 1;
                        }
                        return 1;
                    }
                    if(VID >= 1 && VID <= 20)
                    {
                        if(HireCar[playerid] != VID)
                        {
                            return 1;
                        }
                    }
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "   %s has attempted to Start the vehicle", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    printf("%s", string);
                    EnterCarTime[playerid] += 1;
                    return 1;
                }
                else if(CarRunning[VID] == 1)
                {
                    if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
                    {
                        return 1;
                    }
                    if(IsAnOwnableCar(VID))
                    {
                        if(PlayerInfo[playerid][pPcarkey] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey2] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey3] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey4] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey5] == VID) { }
                        else { return 1; }
                    }
                    if(IsATaxi(VID))
                    {
                        if(PlayerInfo[playerid][pJob] == 14)
                        {
                            GetPlayerName(playerid,sendername,sizeof(sendername));
                            format(string, sizeof(string), "** %s Turns Their Car off.",sendername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            new engine,lights,alarm,doors,bonnet,boot,objective;
                            GetVehicleParamsEx(VID,engine,lights,alarm,doors,bonnet,boot,objective);
                            SetVehicleParamsEx(VID,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                            CarRunning[VID] = 0;
                        }
                        return 1;
                    }
                    if(VID >= 1 && VID <= 20)
                    {
                        if(HireCar[playerid] != VID)
                        {
                            return 1;
                        }
                    }
                    GetPlayerName(playerid,sendername,sizeof(sendername));
                    format(string, sizeof(string), "** %s Turns Their Car off.",sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    new engine,lights,alarm,doors,bonnet,boot,objective;
                    GetVehicleParamsEx(VID,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(VID,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                    CarRunning[VID] = 0;
                }
                else
                {
                SendClientMessage(playerid, COLOR_GREY, " You are not in a car !");
                return 1;
            }
        }
        return 1;
    }
You need to return the original command output as true.
Reply
#3

Quote:
Originally Posted by Swizzzy
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/engine", true) == 0)//start
    {
        if(IsPlayerConnected(playerid))
        {
                new VID;
                VID = GetPlayerVehicleID(playerid);
                //new idcar = GetPlayerVehicleID(playerid);
                if(CarRunning[VID] == 0)
                {
                    if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
                    {
                        return 1;
                    }
                    if(IsASalesVehicle(VID))
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "[INFO]  - You can not take a vehicle from one of the Dealership's");
                        return 1;
                    }
                    if(IsAHarvester(VID))
                    {
                        if(PlayerInfo[playerid][pJob] == 21)
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "   %s has attempted to Start the vehicle", sendername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            printf("%s", string);
                            EnterCarTime[playerid] += 1;
                        }
                        return 1;
                    }
                    if(IsAnOwnableCar(VID))
                    {
                        if(PlayerInfo[playerid][pPcarkey] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey2] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey3] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey4] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey5] == VID) { }
                        else
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "* %s rips off the ignition cover.", sendername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            EnterCarTimeH[playerid] += 1;
                            return 1;
                        }
                    }
                    if(IsATaxi(VID))
                    {
                        if(PlayerInfo[playerid][pJob] == 14)
                        {
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "   %s has attempted to Start the vehicle", sendername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            printf("%s", string);
                            EnterCarTime[playerid] += 1;
                        }
                        return 1;
                    }
                    if(VID >= 1 && VID <= 20)
                    {
                        if(HireCar[playerid] != VID)
                        {
                            return 1;
                        }
                    }
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "   %s has attempted to Start the vehicle", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    printf("%s", string);
                    EnterCarTime[playerid] += 1;
                    return 1;
                }
                else if(CarRunning[VID] == 1)
                {
                    if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
                    {
                        return 1;
                    }
                    if(IsAnOwnableCar(VID))
                    {
                        if(PlayerInfo[playerid][pPcarkey] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey2] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey3] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey4] == VID) { }
                        else if(PlayerInfo[playerid][pPcarkey5] == VID) { }
                        else { return 1; }
                    }
                    if(IsATaxi(VID))
                    {
                        if(PlayerInfo[playerid][pJob] == 14)
                        {
                            GetPlayerName(playerid,sendername,sizeof(sendername));
                            format(string, sizeof(string), "** %s Turns Their Car off.",sendername);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            new engine,lights,alarm,doors,bonnet,boot,objective;
                            GetVehicleParamsEx(VID,engine,lights,alarm,doors,bonnet,boot,objective);
                            SetVehicleParamsEx(VID,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                            CarRunning[VID] = 0;
                        }
                        return 1;
                    }
                    if(VID >= 1 && VID <= 20)
                    {
                        if(HireCar[playerid] != VID)
                        {
                            return 1;
                        }
                    }
                    GetPlayerName(playerid,sendername,sizeof(sendername));
                    format(string, sizeof(string), "** %s Turns Their Car off.",sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    new engine,lights,alarm,doors,bonnet,boot,objective;
                    GetVehicleParamsEx(VID,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(VID,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                    CarRunning[VID] = 0;
                }
                else
                {
                SendClientMessage(playerid, COLOR_GREY, " You are not in a car !");
                return 1;
            }
        }
        return 1;
    }
You need to return the original command output as true.
Oh Thanks mate, never noticed it cause it's an old code since I started coding on sa-mp :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)