need help
#1

hello

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

alright
Reply
#3

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
Reply
#4

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

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

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
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)