SA-MP Forums Archive
Playername help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Playername help (/showthread.php?tid=139158)



Playername help - Steven82 - 04.04.2010

Sorry for flooding the board today(again).

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



Re: Playername help - Beaver07 - 04.04.2010

Код:
#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;
  }



Re: Playername help - dice7 - 04.04.2010

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;
  }



Re: Playername help - Peter_Corneile - 04.04.2010

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


Re: Playername help - Beaver07 - 04.04.2010

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


Re: Playername help - Peter_Corneile - 04.04.2010

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


Re: Playername help - Steven82 - 04.04.2010

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