SA-MP Forums Archive
Fix the 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: Fix the command (/showthread.php?tid=293872)



Fix the command - Join7 - 30.10.2011

Fix the 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]"); // or not /pm directresponse [playerid] [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]"); // or not /pm directresponse [playerid] [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: Fix the command - IstuntmanI - 30.10.2011

What's wrong ?

PS: When somebody gives to a PM, you must to save player ID in a variable.


Re: Fix the command - Join7 - 30.10.2011

I mean, this command only as a response rather than writing to a Message to playerID