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



/me command - RetroEX - 01.02.2019

Hi again!I tried to make a /me command.
The command works but it has a little bug.
Код:
CMD:me(playerid, text[])
{
	new string[128];
	if(sscanf(text, "u", text)) return SendClientMessage(playerid, -1, "{a09d7b}SYNTAX: /me [action]");
	else {
		format(string, 128, "* %s %s", GetName(playerid), text);
		for(new i = 0; i < MAX_PLAYERS; i++){
				new Float: Pos[3];
				GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
				if(IsPlayerInRangeOfPoint(i, 10.0, Pos[0], Pos[1], Pos[2]))
				{
					SendClientMessage(i, COLOR_ME, string);
				}
			}
		}
	return 1;
}
The problem is the first character I wrote is replaced with "я".
For example, I wrote /me this is a test. and the result is:
Код:
* RetroEX яhis is a test.
Why is this happening?


Re: /me command - TheToretto - 01.02.2019

Код:
if(sscanf(text, "u", text)) return SendClientMessage(playerid, -1, "{a09d7b}SYNTAX: /me [action]");
You are unformatting using the wrong specifier.

Use this:
Код:
if(sscanf(text, "s[128]", text)) return SendClientMessage(playerid, -1, "{a09d7b}SYNTAX: /me [action]");



Re: /me command - RetroEX - 02.02.2019

Quote:
Originally Posted by TheToretto
Посмотреть сообщение
Код:
if(sscanf(text, "u", text)) return SendClientMessage(playerid, -1, "{a09d7b}SYNTAX: /me [action]");
You are unformatting using the wrong specifier.

Use this:
Код:
if(sscanf(text, "s[128]", text)) return SendClientMessage(playerid, -1, "{a09d7b}SYNTAX: /me [action]");
Oh thanks.