/me command
#1

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?
Reply
#2

Код:
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]");
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)