SOLVED!
#1

Summary of the Issue:
So I would like to make an /am command for admins chat so only admins would recieve messages on that chat area. I know how to set everything up, but got frustrated and took it out due to the fact that every time they would type /am they would get in chat (AM(Playername): Admins) it would only due one word unless you added _ and then it would show it all but with the _ for spaces. How can I make this so that they do not have to type _ in between the words to space them, where they just type normal?

Ex: This is what Happens:
1) Really typed /am attention all admins ------->> Recieved: AM(playerName):attention

2) Really typed /am attention_all_admins ------->> Received: AM(playerName):attention_all_admins

Ex: This is what needs to Happen:
1) Really typed /am attention all admins ------->> Receive: Am(playerName): attention all admins

Thanks in advance!
Reply
#2

you could try something like this

pawn Код:
if (strcmp(cmdtext, "/am", true) == 0)
{
  new string[128];
 
  // strmid(destinaton, source, index start, max length)
  strmid(string, cmdtext, strfind(cmdtext, " "), strlen(cmdtext));

  // format your string if you need to

  for (new i = 0; i < MAX_PLAYERS; i++)
    // if player is admin
      SendClientMessage(i, COLOUR, string);
  return 1;
}
Reply
#3

Quote:
Originally Posted by Rav
you could try something like this

pawn Код:
if (strcmp(cmdtext, "/am", true) == 0)
{
  new string[128];
 
  // strmid(destinaton, source, index start, max length)
  strmid(string, cmdtext, strfind(cmdtext, " "), strlen(cmdtext));

  // format your string if you need to

  for (new i = 0; i < MAX_PLAYERS; i++)
    // if player is admin
      SendClientMessage(i, COLOUR, string);
  return 1;
}
Thanks a lot Rav! You are very helpful!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)