SA-MP Forums Archive
Edit 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)
+--- Thread: Edit command (/showthread.php?tid=292290)



Edit command - Join7 - 23.10.2011

Edit command.

When someone writes a personal message instead of typing /pmmessage [playerid] [yourtext], take place directly as a response /pmdirectresponse [text]

Код:
	if(strcmp(cmd, "/pmdirectresponse", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, 0xFFFFFFFF, "TYPE: /pmdirectresponse [yourtext]");
				return 1;
			}
			giveplayerid = strval(tmp);
			if (IsPlayerConnected(giveplayerid))
			{
				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, 0xFFFFFFFF, "TYPE: /pmdirectresponse [yourtext]");
					return 1;
				}
				format(string, sizeof(string), "* PM for %s -id: %d: %s", giveplayer, giveplayerid, (result));
				SendClientMessage(playerid,  0xFFFF00FF, string);
				return 1;
			}
		}
		return 1;
	}



Re: Edit command - Paramount. - 23.10.2011

pawn Код:
#include a_samp
#include sscanf2
#include zcmd


CMD:pm(playerid,x[])
{
    new
        idx,str[2][60],text[128],name[24];
    GetPlayerName(playerid,name,24);
    if(sscanf(x,"is[128]",idx,text)) return SendClientMessage(playerid,-1,"use: /pm [playerid] [text]");
    format(str[0],60,"PM %s: %s",name,text);
    format(str[1],60,"Your pm: %s",str);
    SendClientMessage(idx,-1,str[0]);
    SendClientMessage(playerid,-1,str[1]);
    return 0x1;
}



Re: Edit command - Join7 - 23.10.2011

The aim is to miss playerid /pmdirectresponse [text]
when someone has sent you a message, /pmdirectresponse serve to answer (/pmdirectresponse [text] - and sends the message to the one you wrote a personal message)


Re: Edit command - Join7 - 30.10.2011

up...