Playername help
#1

Sorry for flooding the board today(again).

What is the coding to display like any name like on a
Код:
/me
Reply
#2

Код:
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PURPLE 0x800080AA

// Me Cmd
  if(strcmp(cmd, "/me", true) == 0)
  {
  new dir[256];
  dir = strtok(cmdtext, idx);
  strmid(tmp, cmdtext, 4, strlen(cmdtext));
  if(!strlen(dir)) {
  SendClientMessage(playerid,COLOR_YELLOW,"USAGE: /me [message]");
  return 1;
  }
  dir = strtok(cmdtext, idx);
  GetPlayerName(playerid, sendername, sizeof(sendername));
  format(string, sizeof(string), "***%s %s", sendername, tmp);
  SendClientMessageToAll(COLOR_PURPLE,string);
  return 1;
  }
Reply
#3

No need for slow and inefficient strtok

pawn Код:
if(strcmp(cmdtext, "/me", true, 3) == 0)
  {
    if(!cmdtext[3]) return SendClientMessage(playerid, color, "USAGE: /me <something>");
   
    new string[128];
    GetPlayerName(playerid, string, sizeof(string));
    format(string, sizeof(string), "* %s %s", string, cmdtext[4]);
    SendClientMessageToAll(color, string);
    return 1;
  }
Reply
#4

pawn Код:
SendClientMessageToAll(color, string);
Why ToAll ? Shoudnt it be sent only to the player who types the command and people near him/her
Reply
#5

he didnt specify if it was to be local or global.
Reply
#6

Quote:
Originally Posted by Beaver07
he didnt specify if it was to be local or global.
Oh sorry then
Reply
#7

Thanks guys big help, and yes it is both global, and local, but i fugured out the local. , again thanks guys.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)