Unknown Command [REP+]
#1

Hello, i have problem i dont know whats wrong with this command when i try to /loadheroin in my truck it's say
SERVER: Unknown Command
And when i compile everything is fine


pawn Код:
if(strcmp(cmd, "/loadheroin", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pJob] == 16)
            {
                new tmpcar = GetPlayerVehicleID(playerid);
                if(IsPlayerInRangeOfPoint(playerid, 30, -2172.7830,-215.0502,35.3203))
                {
                    if(GetVehicleModel(tmpcar) == 433 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 428 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
                    {
                        if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])
                        {
                            new amount;
                            new compcost = 30;
                            tmp = strtok(cmdtext, idx);
                            if(!strlen(tmp))
                            {
                                SCM(playerid, COLOR_GRAD1, "USAGE: /loadheroin [amount]");
                                return 1;
                            }
                            amount = strval(tmp);
                            if(amount < 1 || amount > 100) { SCM(playerid, COLOR_GREY, "   Can't buy less then 1 gram or more then 100!"); return 1; }
                            new check = PlayerHaul[tmpcar][pHeroin] + amount;
                            if(check > PlayerHaul[tmpcar][pCapasity])
                            {
                                format(string, sizeof(string), "   You went over the Truck heroin Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pHeroin]);
                                SCM(playerid, COLOR_GREY, string);
                                return 1;
                            }
                            new cost = amount*compcost;
                            if(GetPlayerMoney(playerid) >= cost)
                            {
                                PlayerHaul[tmpcar][pHeroin] = amount;
                                format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
                                SCM(playerid, TEAM_GROVE_COLOR, string);
                                format(string, sizeof(string), "You bought %d grams of heroin for $%d. please wait for it to load.", amount,cost);
                                SCM(playerid, TEAM_GROVE_COLOR, string);
                                SafeGivePlayerMoney(playerid,-cost);
                                TogglePlayerControllable(playerid, 0);
                                SetTimer("Unfreezeply", 10000, 0);
                                return 1;
                            }
                            else
                            {
                                format(string, sizeof(string), "You cant afford %d grams Heroin at $%d!", amount,cost);
                                SCM(playerid, TEAM_GROVE_COLOR, string);
                                return 1;
                            }
                        }
                        else
                        {
                            format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
                            SCM(playerid, TEAM_GROVE_COLOR, string);
                            return 1;
                        }
                    }
                    else
                    {
                        SCM(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Heroin.");
                        return 1;
                    }
                }
                else
                {
                    SCM(playerid, COLOR_GREY, "You are not in heroin place.");
                    return 1;
                }
            }
           
        }
        return 1;
    }
Reply
#2

I don't know what is the purpose of the enum PlayerHaul, but I believe it has something to do with players?
pawn Код:
if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])
pawn Код:
if(PlayerHaul[playerid][pHeroin] < PlayerHaul[playerid][pCapasity])
Reply
#3

Quote:
Originally Posted by Loot
Посмотреть сообщение
I don't know what is the purpose of the enum PlayerHaul, but I believe it has something to do with players?
pawn Код:
if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])
pawn Код:
if(PlayerHaul[playerid][pHeroin] < PlayerHaul[playerid][pCapasity])
Same thing, when im away or in other veh its say its not valid veh or right place,but when veh is right and place then say unknown command



Its for heroin,materials,iron

pawn Код:
enum pHaul
{
    pCapasity,
    pMaterials,
    pHeroin,
    pIron,
    pLoad,
};

new PlayerHaul[113][pHaul];
Reply
#4

pawn Код:
if(strcmp(cmd, "/loadheroin", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pJob] == 16)
            {
                new tmpcar = GetPlayerVehicleID(playerid);
                if(IsPlayerInRangeOfPoint(playerid, 30, -2172.7830,-215.0502,35.3203))
                {
                    if(GetVehicleModel(tmpcar) == 433 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 428 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
                    {
                        if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])
                        {
                            new amount;
                            new compcost = 30;
                            tmp = strtok(cmdtext, idx);
                            if(!strlen(tmp))
                            {
                                SCM(playerid, COLOR_GRAD1, "USAGE: /loadheroin [amount]");
                                return 1;
                            }
                            amount = strval(tmp);
                            if(amount < 1 || amount > 100) { SCM(playerid, COLOR_GREY, "   Can't buy less then 1 gram or more then 100!"); return 1; }
                            new check = PlayerHaul[tmpcar][pHeroin] + amount;
                            if(check > PlayerHaul[tmpcar][pCapasity])
                            {
                                format(string, sizeof(string), "   You went over the Truck heroin Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pHeroin]);
                                SCM(playerid, COLOR_GREY, string);
                                return 1;
                            }
                            new cost = amount*compcost;
                            if(GetPlayerMoney(playerid) >= cost)
                            {
                                PlayerHaul[tmpcar][pHeroin] = amount;
                                format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
                                SCM(playerid, TEAM_GROVE_COLOR, string);
                                format(string, sizeof(string), "You bought %d grams of heroin for $%d. please wait for it to load.", amount,cost);
                                SCM(playerid, TEAM_GROVE_COLOR, string);
                                SafeGivePlayerMoney(playerid,-cost);
                                TogglePlayerControllable(playerid, 0);
                                SetTimer("Unfreezeply", 10000, 0);
                                return 1;
                            }
                            else
                            {
                                format(string, sizeof(string), "You cant afford %d grams Heroin at $%d!", amount,cost);
                                SCM(playerid, TEAM_GROVE_COLOR, string);
                            }
                        }
                        else
                        {
                            format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
                            SCM(playerid, TEAM_GROVE_COLOR, string);
                        }
                    }
                    else
                    {
                        SCM(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Heroin.");
                    }
                }
                else
                {
                    SCM(playerid, COLOR_GREY, "You are not in heroin place.");
                }
            }

        }
        return 1;
    }
Reply
#5

Quote:
Originally Posted by ToiletDuck
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/loadheroin", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pJob] == 16)
            {
                new tmpcar = GetPlayerVehicleID(playerid);
                if(IsPlayerInRangeOfPoint(playerid, 30, -2172.7830,-215.0502,35.3203))
                {
                    if(GetVehicleModel(tmpcar) == 433 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 428 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
                    {
                        if(PlayerHaul[tmpcar][pHeroin] < PlayerHaul[tmpcar][pCapasity])
                        {
                            new amount;
                            new compcost = 30;
                            tmp = strtok(cmdtext, idx);
                            if(!strlen(tmp))
                            {
                                SCM(playerid, COLOR_GRAD1, "USAGE: /loadheroin [amount]");
                                return 1;
                            }
                            amount = strval(tmp);
                            if(amount < 1 || amount > 100) { SCM(playerid, COLOR_GREY, "   Can't buy less then 1 gram or more then 100!"); return 1; }
                            new check = PlayerHaul[tmpcar][pHeroin] + amount;
                            if(check > PlayerHaul[tmpcar][pCapasity])
                            {
                                format(string, sizeof(string), "   You went over the Truck heroin Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pHeroin]);
                                SCM(playerid, COLOR_GREY, string);
                                return 1;
                            }
                            new cost = amount*compcost;
                            if(GetPlayerMoney(playerid) >= cost)
                            {
                                PlayerHaul[tmpcar][pHeroin] = amount;
                                format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
                                SCM(playerid, TEAM_GROVE_COLOR, string);
                                format(string, sizeof(string), "You bought %d grams of heroin for $%d. please wait for it to load.", amount,cost);
                                SCM(playerid, TEAM_GROVE_COLOR, string);
                                SafeGivePlayerMoney(playerid,-cost);
                                TogglePlayerControllable(playerid, 0);
                                SetTimer("Unfreezeply", 10000, 0);
                                return 1;
                            }
                            else
                            {
                                format(string, sizeof(string), "You cant afford %d grams Heroin at $%d!", amount,cost);
                                SCM(playerid, TEAM_GROVE_COLOR, string);
                            }
                        }
                        else
                        {
                            format(string, sizeof(string), "Heroin: %d/%d.", PlayerHaul[tmpcar][pHeroin],PlayerHaul[tmpcar][pCapasity]);
                            SCM(playerid, TEAM_GROVE_COLOR, string);
                        }
                    }
                    else
                    {
                        SCM(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Heroin.");
                    }
                }
                else
                {
                    SCM(playerid, COLOR_GREY, "You are not in heroin place.");
                }
            }

        }
        return 1;
    }
Still same
Reply
#6

Quote:
Originally Posted by Don_Cage
Посмотреть сообщение
Still same
if you use the command it says unknown CMD?
Reply
#7

Quote:
Originally Posted by ToiletDuck
Посмотреть сообщение
if you use the command it says unknown CMD?
Yes,when i write wrong command on my server it should be message like it is always

The command you are trying to use is not part of our server

And only on this command SERVER: Unknown Command and yea still same unknown command with your code
Reply
#8

No errors were given in runtime? Try checking your log
Reply
#9

Quote:
Originally Posted by Raisingz
Посмотреть сообщение
No errors were given in runtime? Try checking your log
As i said no errors
Reply
#10

Not having a clue, first though...
Is it "if(strcmp(cmd, "/loadheroin", true) == 0)" or "if(strcmp(cmdtext, "/loadheroin", true) == 0)"
?

EDIT: nvm that's stupid, since ti gives you the wrong message if you're in an incorrect vehicle..
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)