/do CMD [RP]
#8

the reason for the double chat spamis the return 0;
Код:
if(strcmp( cmd, "/me", true ) == 0 )
{
	if(IsPlayerConnected(playerid))
	{
		new tmp[128];
		tmp = strtok(cmdtext,idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /me [action]");
			return 1;// here it was 0; returning a false (0) will result in "unknown command", return true (1) stops the spam
		}
		new sendername[MAX_PLAYER_NAME];
		GetPlayerName(playerid, sendername, sizeof(sendername));
		new str[128];
		format(str,sizeof(str),"*%s %s",sendername, tmp);
		ProxDetector(10.0, playerid, str, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
	}
	return 1;
}
edit: Wesley221's solution +1 btw
Код:
COMMAND:me(playerid, cmdtext[])
{
    new Message[128], name[24], string[128];
    GetPlayerName(playerid, name, sizeof name);
    if(!sscanf(cmdtext, "s[128]", Message))
    {
        format(string, sizeof string, " * %s said %s ", name, Message);
        // Prox thingy here
    } else return SendClientMessage(playerid, -1, "Usage: /me [text]");
    return 1;
}
fixed the string size... [128]
Reply


Messages In This Thread
/do CMD [RP] - by 963852741 - 07.07.2011, 12:48
Re: /do CMD [RP] - by Wesley221 - 07.07.2011, 12:50
Re: /do CMD [RP] - by 963852741 - 07.07.2011, 12:50
Re: /do CMD [RP] - by Harry_Sandhu - 07.07.2011, 12:52
Re: /do CMD [RP] - by 963852741 - 07.07.2011, 12:53
Re: /do CMD [RP] - by HyperZ - 07.07.2011, 12:53
Re: /do CMD [RP] - by Wesley221 - 07.07.2011, 12:55
Re: /do CMD [RP] - by Babul - 07.07.2011, 12:57
Re: /do CMD [RP] - by Elorreli - 07.07.2011, 13:07
Re: /do CMD [RP] - by Wesley221 - 07.07.2011, 13:11

Forum Jump:


Users browsing this thread: 1 Guest(s)