[Help]: An Admin Message
#1

hello!

How can I make like that, when a player type one command, then an admin can see what he/she typed...Like:

%s Has Typed: %s....

I tried like this, but it doesn't work.

Code:

public OnPlayerText(playerid, text[])

PHP код:
  if (text[0] == '/')
  {
  new 
CMDMessage[128];
  
GetPlayerName(playeridCMDMessageMAX_PLAYER_NAME);
  
format(CMDMessage sizeof CMDMessage"*__* %s Has Typed: %s" CMDMessagetext[1]);
  
SendAdminMessage(COLOR_GREYCMDMessage);
  return 
1;

But this didn't work

Thanks for your help!
Reply
#2

Change text [1] to text if you don't want that / to come then do text[0] = ' '; then do format with text.Its fixed.

text[1] will give only the 2nd character of the string not the whole string from 2nd character.

Код:
text[0] = ' ';
format(string,sizeof(string),"**%s(%d) has typed %s",pName,playerid,text);
Reply
#3

Quote:
Originally Posted by Yashas
Посмотреть сообщение
Change text [1] to text if you don't want that / to come then do text[0] = ' '; then do format with text.Its fixed.

text[1] will give only the 2nd character of the string not the whole string from 2nd character.

Код:
text[0] = ' ';
format(string,sizeof(string),"**%s(%d) has typed %s",pName,playerid,text);
Like that?

PHP код:
  if (text[0] == ' ')
  {
  new 
CMDMessage[128];
  
GetPlayerName(playeridCMDMessageMAX_PLAYER_NAME);
  
format(CMDMessage sizeof CMDMessage"*__* %s[%d] Has Typed: %s" ,GetName(playerid), playeridtext);
  
SendAdminMessage(COLOR_GREYCMDMessage);
  return 
1;

Reply
#4

pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(str, sizeof(str), "%s[ID:%d] typed the command %s", name, playerid, cmdtext);
    SendMessageToAll(playerid, -1, str);//Change this to send the command to admins only.
    return 1;
}
Reply
#5

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(str, sizeof(str), "%s[ID:%d] typed the command %s", name, playerid, cmdtext);
    SendMessageToAll(playerid, -1, str);//Change this to send the command to admins only.
    return 1;
}
Thanks
Reply
#6

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(str, sizeof(str), "%s[ID:%d] typed the command %s", name, playerid, cmdtext);
    SendMessageToAll(playerid, -1, str);//Change this to send the command to admins only.
    return 1;
}
How do you know that he uses ZCMD or any command processor??If he uses this is a better option than OnPlayerText.

EDIT:He uses CMD Processor - Areax posted before me :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)