Player not Getting Message - /selldrugs command
#1

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;
	}
Reply
#2

Is everyone dead? :P
Reply
#3

yes zombies attacked!
Reply
#4

Quote:
Originally Posted by XxCozxX
yes zombies attacked!
can I have a person over 8 years old to help me?
Reply
#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
#6

No i dont, and it already asked for the id! Good Try! Anyone Else Wanna step up and complete my "WTF /selldrugs command"
Reply
#7

Im 14 and ask a silly question get a silly answer.
Reply
#8

Quote:
Originally Posted by XxCozxX
Im 14 and ask a silly question get a silly answer.
how is this silly little boy?
Reply
#9

1. Try to make sense in your posts.
2. If you meant who instead of how, im cozza.
Reply
#10

Quote:
Originally Posted by XxCozxX
1. Try to make sense in your posts.
2. If you meant who instead of how, im cozza.
I said how is that childish -_-
Stay in School, Trying to insult me and trying to fit in
How about you go away, do your homework, and shut up and help people if they do need help
not writing childish little comments on peoples post.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)