SA-MP Forums Archive
Player not Getting Message - /selldrugs command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Player not Getting Message - /selldrugs command (/showthread.php?tid=94067)



Player not Getting Message - /selldrugs command - Eazy_Efolife - 27.08.2009

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;
	}



Re: Player not Getting Message - /selldrugs command - Eazy_Efolife - 28.08.2009

Is everyone dead? :P


Re: Player not Getting Message - /selldrugs command - XxCozxX - 28.08.2009

yes zombies attacked!


Re: Player not Getting Message - /selldrugs command - Eazy_Efolife - 28.08.2009

Quote:
Originally Posted by XxCozxX
yes zombies attacked!
can I have a person over 8 years old to help me?


Re: Player not Getting Message - /selldrugs command - Hiitch - 28.08.2009

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? "


Re: Player not Getting Message - /selldrugs command - Eazy_Efolife - 28.08.2009

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


Re: Player not Getting Message - /selldrugs command - XxCozxX - 28.08.2009

Im 14 and ask a silly question get a silly answer.


Re: Player not Getting Message - /selldrugs command - Eazy_Efolife - 28.08.2009

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


Re: Player not Getting Message - /selldrugs command - XxCozxX - 28.08.2009

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


Re: Player not Getting Message - /selldrugs command - Eazy_Efolife - 28.08.2009

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.