Player not Getting Message - /selldrugs command
#5

Quote:
Originally Posted by Compton's Eazy E
The Problem is that when I do /selldrugs (to whoever), they dont get a message that someone wants to sell drugs to them, Can Someone explain whats wrong, or whats missing?

Код:
 	if(strcmp(cmd, "/selldrugs", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
		  if(PlayerInfo[playerid][pJob] != 2)
		  {
				SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You are not a drugs dealer!");
				return 1;
		  }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /selldrugs [playerid] [amount]");
				return 1;
			}
			new playa;
			new needed;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp)) { return 1; }
			needed = strval(tmp);
			if(needed < 1 || needed > 50) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] 1-50 only."); return 1; }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp)) { return 1; }
			if(needed > PlayerInfo[playerid][pDrugs]) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You don't have that much!"); return 1; }
			if(IsPlayerConnected(playa))
			{
			  if(playa != INVALID_PLAYER_ID)
			  {
					if (ProxDetectorS(8.0, playerid, playa))
					{
					  if(playa != playerid)
					  {
						  format(string, sizeof(string), "[INFO:] You have gave %s %d grams of drugs.", GetPlayerNameEx(playa), needed);
							SendClientMessage(playerid, COLOR_LIGHTYELLOW2, string);
							format(string, sizeof(string), "[INFO:] %s has just gave you %d grams of drugs.", GetPlayerNameEx(playerid), needed);
							SendClientMessage(playa, COLOR_LIGHTYELLOW2, string);
							PlayerInfo[playa][pDrugs] += needed;
							PlayerInfo[playerid][pDrugs] -= needed;
							PlayerPlayerActionMessage(playerid,playa,15.0,"has just gave some drugs to");
						}
						else
						{
						  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You can't sell yourself drugs!");
						}
					}
					else
					{
					  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You arn't near that player!");
					}
				}
			}
			else
			{
			  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid ID.");
			}
		}
		return 1;
	}
pawn Код:
if(strcmp(cmd, "/selldrugs", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
          if(PlayerInfo[playerid][pJob] != 2)
          {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You are not a drugs dealer!");
                return 1;
          }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /selldrugs [playerid] [amount]");
                return 1;
            }
            new playa;
            new needed;
            playa = strval(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) { return 1; }
            needed = strval(tmp);
            if(needed < 1 || needed > 50) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] 1-50 only."); return 1; }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) { return 1; }
            if(needed > PlayerInfo[playerid][pDrugs]) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You don't have that much!"); return 1; }
            if(IsPlayerConnected(playa))
            {
              if(playa != INVALID_PLAYER_ID)
              {
                    if (ProxDetectorS(8.0, playerid, playa))
                    {
                      if(playa != playerid)
                      {
                          format(string, sizeof(string), "[INFO:] You have gave %s %d grams of drugs.", GetPlayerNameEx(playa), needed);
                            SendClientMessage(playerid, COLOR_LIGHTYELLOW2, string);
                            format(string, sizeof(string), "[INFO:] %s has just gave you %d grams of drugs.", GetPlayerNameEx(playerid), needed);
                            SendClientMessage(playa, COLOR_LIGHTYELLOW2, string);
                            PlayerInfo[playa][pDrugs] += needed;
                            PlayerInfo[playerid][pDrugs] -= needed;
                            PlayerPlayerActionMessage(playerid,playa,15.0,"has just gave some drugs to");
                        }
                        else
                        {
                          SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You can't sell yourself drugs!");
                        }
                    }
                    else
                    {
                      SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You arn't near that player!");
                    }
                }
            }
            else
            {
              SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid ID.");
            }
        }
        return 1;
    }
All I did was change the ReturnUser to a strval, strval meaning it will ask for an ID instead of the users name, I dont think this will solve the problem, but at least you don't have to type the player name now.

By the way, when you try to sell the player the drugs, if they don't get a message, do you get " Server : Unknown command? "
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)