PM Reply command
#1

To this PM command. I want to make the Reply command (/reply [text]). When someone writes the command /reply directly responsible, not to write long /pm [playerid] [text]

Код:
	if(strcmp(cmd, "/pm", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, GRAY, "USE: /pm [playerid] [text]");
				return 1;
			}
			giveplayerid = strval(tmp);
			if (IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid!= INVALID_PLAYER_ID)
			    {
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					new length = strlen(cmdtext);
					while ((idx < length) && (cmdtext[idx] <= ' '))
					{
						idx++;
					}
					new offset = idx;
					new result[256];
					while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
					{
						result[idx - offset] = cmdtext[idx];
						idx++;
					}
					result[idx - offset] = EOS;
					if(!strlen(result))
					{
						SendClientMessage(playerid, GRAY, "USE: /pm [playerid] [text]");
						return 1;
					}
					for(new i = 0; i < MAX_PLAYERS; i++)
					{
						if(IsPlayerConnected(i))
						{
							format(string, sizeof(string), "* PM from %s(ID: %d): %s", PlayerName(playerid), playerid, (result));
							SendClientMessage(giveplayerid, YELLOW, string);
						}
					}
					format(string, sizeof(string), "* PM for %s(ID: %d): %s", giveplayer, giveplayerid, (result));
					SendClientMessage(playerid,  YELLOW, string);
					return 1;
				}
			}
			else
			{
					format(string, sizeof(string), "%d is not active player.", giveplayerid);
					SendClientMessage(playerid, GRAY, string);
			}
		}
		return 1;
	}
Reply


Messages In This Thread
PM Reply command - by Join7 - 04.11.2011, 20:27
Re: PM Reply command - by Calgon - 04.11.2011, 20:35
Re: PM Reply command - by Join7 - 04.11.2011, 20:53
Re: PM Reply command - by Join7 - 05.11.2011, 08:38

Forum Jump:


Users browsing this thread: 1 Guest(s)