Drugs runs problem.
#1

Hello, I'm getting "SERVER: Unknown command." when I do /pickdrugs. Here's the code:
pawn Код:
if(strcmp(cmd, "/pickdrugs", true) == 0)
    {
    if(IsPlayerConnected(playerid))
        {
            new tmpcar = GetPlayerVehicleID(playerid);
            if (IsPlayerInAnyVehicle(playerid))
        {
            if(PlayerToPoint(4.0, playerid, -72.8756,-1539.0819,2.6172))
            {
                    if(PlayerHaul[tmpcar][pDrugsx] == 0)
                    {
                    tmp = strtok(cmdtext, idx);
                        new check = PlayerHaul[tmpcar][pDrugsx];
                        if(check >= 50)
                        {
                        format(string, sizeof(string), "  Your car is full.");
                        SendClientMessage(playerid, COLOR_RED, string);
                        return 1;
                        }
                        if(GetPlayerMoney(playerid) >= 500000)
                        {
                            PlayerHaul[tmpcar][pDrugsx] = 50;
                            format(string, sizeof(string), "    You bought [50] Kilograms of drugs.");
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            GivePlayerMoney(playerid,-500000);
                            return 1;
                        }
                        else
                        {
                            format(string, sizeof(string), "[ERROR] You need $ 500.000 to buy drugs!");
                            SendClientMessage(playerid, COLOR_RED, string);
                            return 1;
                        }
                    }
                    else
                        {
                            format(string, sizeof(string), "[ERROR] You already bought drugs.");
                            SendClientMessage(playerid, COLOR_RED, string);
                            return 1;
                        }
              }
              else
        {
        format(string, sizeof(string), "ERROR: You are not at the drugs load place.");
        SendClientMessage(playerid, COLOR_RED, string);
        return 1;
        }
            }
        else
        {
        format(string, sizeof(string), "ERROR: You are not in a car.");
        SendClientMessage(playerid, COLOR_RED, string);
        return 1;
        }
    }
        return 1;
    }
    if(strcmp(cmd, "/putdrugs", true) == 0)
    {
    if(IsPlayerConnected(playerid))
        {
            new tmpcar = GetPlayerVehicleID(playerid);
            if (IsPlayerInAnyVehicle(playerid))
        {
            if(Drugs <= 1000)
            {
            if(PlayerToPoint(4.0, playerid, 2735.5935,-2466.1265,13.6484))
            {
                    if(PlayerHaul[tmpcar][pDrugsx] == 50)
                    {
                    tmp = strtok(cmdtext, idx);
                        new check = PlayerHaul[tmpcar][pDrugsx];
                        if(check <= 50)
                        {
                        format(string, sizeof(string), "  You don't have drugs in the car");
                        SendClientMessage(playerid, COLOR_RED, string);
                        return 1;
                        }
                        else if(check >= 50)
                        {
                            PlayerHaul[tmpcar][pDrugsx] = 0;
                            Drugs += 50;
                            SaveStocks();
                            format(string, sizeof(string), "    You sold 50Kg's of drugs and recieved $520.000 from the handler.");
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            GivePlayerMoney(playerid,520000);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            return 1;
                        }
                        else
                        {
                            format(string, sizeof(string), "ERROR: No drugs in the vehicle!");
                            SendClientMessage(playerid, COLOR_RED, string);
                            return 1;
                        }
                    }
                }
else
            {
                format(string, sizeof(string), "ERROR: You aren't at drugs unload place.");
                SendClientMessage(playerid, COLOR_RED, string);
                return 1;
            }
            }
            else
            {
                format(string, sizeof(string), "ERROR: Drug stock full!!");
                SendClientMessage(playerid, COLOR_RED, string);
            return 1;
            }
            }
        else
        {
        format(string, sizeof(string), "ERROR: You are not in a car.");
        SendClientMessage(playerid, COLOR_RED, string);
        return 1;
        }
        }
        return 1;
    }
Thank you very much !
Reply
#2

it seems fine to me, maybe i overlooked it. Are you sure you placed this under OnPlayerCommandText?
Reply
#3

Quote:
Originally Posted by [B2K
Hustler ]
it seems fine to me, maybe i overlooked it. Are you sure you placed this under OnPlayerCommandText?
Yeh ofc. But when I went to Point that is defined in this code it says "SERVER: Unknown command." if I left this point it says: "ERROR: You are not at the drugs load place." What is good.
Reply
#4

what do you mean by "Point"? u mean PlayerToPoint?
Show us what you did for that (the code).
Reply
#5

Quote:
Originally Posted by [B2K
Hustler ]
what do you mean by "Point"? u mean PlayerToPoint?
Show us what you did for that (the code).
I mean PlayerToPoint yes, if(PlayerToPoint(4.0, playerid, -72.8756,-1539.0819,2.6172)) <-- When I'm here I get "SERVER:Unknown Command"
Reply
#6

Can you help ?
Reply
#7

ok, so when you go to that place (point) you get the "SERVER: UNKNOWN COMMAND" message, but when you go out of that point (playertopoint) you get the message that you are not at that place (SendClientMessage ERROR: You are not at the drugs load place) - that's fine.

That means that there is a problem somewhere here:
pawn Код:
if(PlayerHaul[tmpcar][pDrugsx] == 0)
                {
          tmp = strtok(cmdtext, idx);
          new check = PlayerHaul[tmpcar][pDrugsx];
          if(check >= 50)
                    {
            format(string, sizeof(string), "  Your car is full.");
            SendClientMessage(playerid, COLOR_RED, string);
            return 1;
          }
          if(GetPlayerMoney(playerid) >= 500000)
                    {
            PlayerHaul[tmpcar][pDrugsx] = 50;
            format(string, sizeof(string), "    You bought [50] Kilograms of drugs.");
            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
            GivePlayerMoney(playerid,-500000);
            return 1;
          }
          else
                    {
            format(string, sizeof(string), "[ERROR] You need $ 500.000 to buy drugs!");
            SendClientMessage(playerid, COLOR_RED, string);
            return 1;
          }
        }
        else
                {
          format(string, sizeof(string), "[ERROR] You already bought drugs.");
          SendClientMessage(playerid, COLOR_RED, string);
          return 1;
        }
check it through and there may be a problem there.

I'll give it a shot. try this:

pawn Код:
if(strcmp(cmd, "/pickdrugs", true) == 0)
{
  if(IsPlayerConnected(playerid))
    {
    new tmpcar = GetPlayerVehicleID(playerid);
    if (IsPlayerInAnyVehicle(playerid))
        {
      if(PlayerToPoint(4.0, playerid, -72.8756,-1539.0819,2.6172))
            {
        if(PlayerHaul[tmpcar][pDrugsx] == 0)
                {
          tmp = strtok(cmdtext, idx);
          new check = PlayerHaul[tmpcar][pDrugsx];
          if(check >= 50)
                    {
            format(string, sizeof(string), "  Your car is full.");
            SendClientMessage(playerid, COLOR_RED, string);
            return 1;
          }
          if(GetPlayerMoney(playerid) >= 500000)
                    {
            PlayerHaul[tmpcar][pDrugsx] = 50;
            format(string, sizeof(string), "    You bought [50] Kilograms of drugs.");
            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
            GivePlayerMoney(playerid,-500000);
            return 1;
          }
          else
                    {
            format(string, sizeof(string), "[ERROR] You need $ 500.000 to buy drugs!");
            SendClientMessage(playerid, COLOR_RED, string);
            return 1;
          }
          return 1;
        }
        else
                {
          format(string, sizeof(string), "[ERROR] You already bought drugs.");
          SendClientMessage(playerid, COLOR_RED, string);
          return 1;
        }
        return 1;
      }
      else
            {
        format(string, sizeof(string), "ERROR: You are not at the drugs load place.");
        SendClientMessage(playerid, COLOR_RED, string);
        return 1;
      }
    }
    else
        {
      format(string, sizeof(string), "ERROR: You are not in a car.");
      SendClientMessage(playerid, COLOR_RED, string);
      return 1;
    }
  }
  return 1;
}


if(strcmp(cmd, "/putdrugs", true) == 0)
{
  if(IsPlayerConnected(playerid))
    {
    new tmpcar = GetPlayerVehicleID(playerid);
    if (IsPlayerInAnyVehicle(playerid))
        {
      if(Drugs <= 1000)
            {
        if(PlayerToPoint(4.0, playerid, 2735.5935,-2466.1265,13.6484))
                {
          if(PlayerHaul[tmpcar][pDrugsx] == 50)
                    {
            tmp = strtok(cmdtext, idx);
            new check = PlayerHaul[tmpcar][pDrugsx];
            if(check <= 50)
                        {
              format(string, sizeof(string), "  You don't have drugs in the car");
              SendClientMessage(playerid, COLOR_RED, string);
              return 1;
            }
            else if(check >= 50)
                        {
              PlayerHaul[tmpcar][pDrugsx] = 0;
              Drugs += 50;
              SaveStocks();
              format(string, sizeof(string), "  You sold 50Kg's of drugs and recieved $520.000 from the handler.");
              SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
              GivePlayerMoney(playerid,520000);
              PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
              return 1;
            }
            else
                        {
              format(string, sizeof(string), "ERROR: No drugs in the vehicle!");
              SendClientMessage(playerid, COLOR_RED, string);
              return 1;
            }
          }
        }
        else
                {
          format(string, sizeof(string), "ERROR: You aren't at drugs unload place.");
          SendClientMessage(playerid, COLOR_RED, string);
          return 1;
        }
      }
      else
            {
        format(string, sizeof(string), "ERROR: Drug stock full!!");
        SendClientMessage(playerid, COLOR_RED, string);
        return 1;
      }
    }
    else
        {
      format(string, sizeof(string), "ERROR: You are not in a car.");
      SendClientMessage(playerid, COLOR_RED, string);
      return 1;
    }
  }
  return 1;
}
indentation shows up wrong here, correct it when u paste it in pawn.
Reply
#8

Doesn't work
Reply
#9

Can anyone help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)