SA-MP Forums Archive
OnPlayerCommandPerformed - 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: OnPlayerCommandPerformed (/showthread.php?tid=479174)



OnPlayerCommandPerformed - Blackazur - 03.12.2013

~fixed~


Re: OnPlayerCommandPerformed - Tagathron - 03.12.2013

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


Re: OnPlayerCommandPerformed - ]Rafaellos[ - 03.12.2013

Use sscanf to split it.


AW: OnPlayerCommandPerformed - Blackazur - 03.12.2013

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


Re: OnPlayerCommandPerformed - 0x41726d79 - 03.12.2013

Aaaaa, you want to do private message command ?


Re: OnPlayerCommandPerformed - Kyance - 03.12.2013

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


Re: OnPlayerCommandPerformed - Jefff - 03.12.2013

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



AW: Re: OnPlayerCommandPerformed - Blackazur - 03.12.2013

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!


Re: OnPlayerCommandPerformed - RajatPawar - 03.12.2013

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


Re: OnPlayerCommandPerformed - Jefff - 03.12.2013

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