[Help]: An Admin Message - 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)
+--- Thread: [Help]: An Admin Message (
/showthread.php?tid=434785)
[Help]: An Admin Message -
Areax - 04.05.2013
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(playerid, CMDMessage, MAX_PLAYER_NAME);
format(CMDMessage , sizeof CMDMessage, "*__* %s Has Typed: %s" , CMDMessage, text[1]);
SendAdminMessage(COLOR_GREY, CMDMessage);
return 1;
}
But this didn't work
Thanks for your help!
Re: [Help]: An Admin Message -
Yashas - 04.05.2013
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);
Re: [Help]: An Admin Message -
Areax - 04.05.2013
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(playerid, CMDMessage, MAX_PLAYER_NAME);
format(CMDMessage , sizeof CMDMessage, "*__* %s[%d] Has Typed: %s" ,GetName(playerid), playerid, text);
SendAdminMessage(COLOR_GREY, CMDMessage);
return 1;
}
Re: [Help]: An Admin Message -
DaRk_RaiN - 04.05.2013
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;
}
Re: [Help]: An Admin Message -
Areax - 04.05.2013
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
Re: [Help]: An Admin Message -
Yashas - 04.05.2013
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