07.07.2011, 12:57
the reason for the double chat spamis the return 0;
edit: Wesley221's solution +1 btw
fixed the string size... [128]
Код:
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; }
Код:
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; }