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



need help - Artak - 09.03.2012

hello

how to know what command typed player
like if player typed /help. admin can see it, but only admin


Re: need help - Marco_Valentine - 09.03.2012

alright


Re: need help - Marco_Valentine - 09.03.2012

pawn Код:
if(strcmp(cmd, "/help",true)==0)
    {
                   new string[64];
                   GetPlayerName(playerid, sendername, sizeof(sendername));
                   format(string,sizeof(string)," %s used /help");
        SendClientMessage(playerid, COLOR," you used /help");
               }
               for(new i = 0; i < MAX_PLAYERS; i++)
    {
            if(PlayerInfo[i][pAdmin] >= 1)
            {
                SendClientMessage(i, COLOR, string);
            }
    return 1;
    }
Change pAdmin to how your script detects if a players an admin
Mkae sure you have
new sendername[MAX_PLAYER_NAME];
at the top of onplayercommandtext

This sends a message to all the admins online telling them that the player used /help..


_______________________________________
Please rep+ me!!! hit the little star under my name


Re: need help - Artak - 09.03.2012

but not only /help its example. need to see all commands what player typed


Re: need help - Marco_Valentine - 09.03.2012

you have to edit each command individually. You do realise if you do this. All your admins will be spammed


Re: need help - Artak - 09.03.2012

Quote:
Originally Posted by Marco_Valentine
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/help",true)==0)
    {
                   new string[64];
                   GetPlayerName(playerid, sendername, sizeof(sendername));
                   format(string,sizeof(string)," %s used /help");
        SendClientMessage(playerid, COLOR," you used /help");
               }
               for(new i = 0; i < MAX_PLAYERS; i++)
    {
            if(PlayerInfo[i][pAdmin] >= 1)
            {
                SendClientMessage(i, COLOR, string);
            }
    return 1;
    }
Change pAdmin to how your script detects if a players an admin
Mkae sure you have
new sendername[MAX_PLAYER_NAME];
at the top of onplayercommandtext

This sends a message to all the admins online telling them that the player used /help..
anyway thx you give me good example


Re: need help - eesh - 09.03.2012

if your using strcmp
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
        new cmd[128],idx;
        cmd = strtok(cmd,idx);
    if(PlayerInfo[playerid][pAdmin] == 0)
    {
        new name[24];
        GetPlayerName(playerid,name,24);
        new str[128];
        format(str,128,"%s used command: %s",name,cmd);
        for(new i;i<MAX_PLAYERS;i++)
        {
            if(PlayerInfo[i][pAdmin] != 0)
            {
                SendClientMessage(i,0xAAAAAAAA,str);
            }
        }
    }
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}