OnPlayerCommandPerformed
#1

~fixed~
Reply
#2

If you mean on "USAGE : /pm [MESSAGE]" or similar you can use sscanf to accomplish it
Reply
#3

Use sscanf to split it.
Reply
#4

no i want that it not show "/pm blabla". i will that it just show the "/pm"
Reply
#5

Aaaaa, you want to do private message command ?
Reply
#6

EDIT: nvm..
You can just use this on the :PM script
pawn Код:
format(str, sizeof(str), "[PLAYER] - %s[%d] has used the command PM", PlayerName(playerid),playerid);
        SendMessageToAllAdmins(str,-1);
And the same on any other cmd(just change the "PM" to the cmds name) :P
Reply
#7

pawn Код:
new pos = strfind(cmdtext," ",true);
if(pos > -1)
{
    cmdtext[pos] = '\0';
    new str[128];
    format(str, sizeof(str),""chat" {94ED40}%s (%d) has used: %s",PlayerName(playerid),playerid,cmdtext);
    SendMessageToAllAdmins(str,-1);
}
Reply
#8

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
new pos = strfind(cmdtext," ",true);
if(pos > -1)
{
    cmdtext[pos] = '\0';
    new str[128];
    format(str, sizeof(str),""chat" {94ED40}%s (%d) has used: %s",PlayerName(playerid),playerid,cmdtext);
    SendMessageToAllAdmins(str,-1);
}
thanks!
Reply
#9

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
new pos = strfind(cmdtext," ",true);
if(pos > -1)
{
    cmdtext[pos] = '\0';
    new str[128];
    format(str, sizeof(str),""chat" {94ED40}%s (%d) has used: %s",PlayerName(playerid),playerid,cmdtext);
    SendMessageToAllAdmins(str,-1);
}
Thought of exactly that but what if he decides to use a command like "/take item shovel"? So better use SSCANF
Reply
#10

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
Thought of exactly that but what if he decides to use a command like "/take item shovel"? So better use SSCANF
Then admins see '/take'

Here is a small update if player type only '/pm' without any txt you can see '/pm' too
pawn Код:
new len = strlen(cmdtext);
new pos = strfind(cmdtext," ",true);
if(pos > -1 || cmdtext[len - 1] == '\0')
{
    if(pos > -1)
        cmdtext[pos] = '\0';

    new str[128];
    format(str, sizeof(str),""chat" {94ED40}%s (%d) has used: %s",PlayerName(playerid),playerid,cmdtext);
    SendMessageToAllAdmins(str,-1);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)