> > > >

cmd_target | amxmisc | AMX X Documentation

Includes

    1. Stocks
    1. Natives
    2. Forwards
    1. Natives
    2. Stocks
    1. Natives
    2. Stocks
    1. Natives
    1. Natives
    2. Stocks
    1. Natives
    1. Natives
    2. Forwards
    3. Stocks
    1. Natives
    2. Forwards
    1. Natives
    1. Natives
    1. Natives
    2. Stocks
    1. Natives
    2. Forwards
    1. Natives
    1. Natives
    2. Forwards
    1. Natives
    2. Forwards
    1. Stocks
    1. Natives
    1. Natives
    2. Stocks
    1. Stocks
    1. Stocks
    1. Natives
    1. Natives
    2. Forwards
    3. Stocks
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    2. Stocks
    1. Natives
    1. Natives
    1. Stocks
    1. Natives
    1. Natives
    1. Natives
    2. Forwards
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    2. Forwards
    1. Natives
    2. Stocks
    1. Natives
    1. Natives
    1. Natives
    2. Stocks
    1. Natives
    1. Stocks
    1. Natives
    1. Natives
    1. Natives
    1. Natives
    2. Forwards
    3. Stocks
    1. Stocks
    1. Natives
    2. Forwards
    3. Stocks
    1. Natives
    1. Natives
    2. Forwards
    3. Stocks
    1. Natives
    1. Natives
    2. Stocks
    1. Stocks

cmd_target

Syntax
									stock cmd_target(id, const arg[], flags = CMDTARGET_OBEY_IMMUNITY)
									{
     new player = find_player("bl", arg);
     if (player)
     {
          if (player != find_player("blj", arg))
          {
               console_print(id, "%L", id, "MORE_CL_MATCHT");
               return 0;
          }
     }
     else if ((player = find_player("c", arg)) == 0 && arg[0] == '#' && arg[1])
     {
          player = find_player("k", str_to_num(arg[1]));
     }
     if (!player)
     {
          console_print(id, "%L", id, "CL_NOT_FOUND");
          return 0;
     }
     if (flags & CMDTARGET_OBEY_IMMUNITY)
     {
          if ((get_user_flags(player) & ADMIN_IMMUNITY) && ((flags & CMDTARGET_ALLOW_SELF) ? (id != player) : true))
          {
               new imname[MAX_NAME_LENGTH];
               get_user_name(player, imname, charsmax(imname));
               console_print(id, "%L", id, "CLIENT_IMM", imname);
               return 0;
          }
     }
     if (flags & CMDTARGET_ONLY_ALIVE)
     {
          if (!is_user_alive(player))
          {
               new imname[MAX_NAME_LENGTH];
               get_user_name(player, imname, charsmax(imname));
               console_print(id, "%L", id, "CANT_PERF_DEAD", imname);
               return 0;
          }
     }
     if (flags & CMDTARGET_NO_BOTS)
     {
          if (is_user_bot(player))
          {
               new imname[MAX_NAME_LENGTH];
               get_user_name(player, imname, charsmax(imname));
               console_print(id, "%L", id, "CANT_PERF_BOT", imname);
               return 0;
          }
     }

     return player;
}
								
Variable Description
id
Client index of admin performing an action
arg
Target pattern
flags
Filtering flags, see CMDTARGET_* constants above

Description
Processes a generic target pattern and tries to match it to a client based on filtering flags. If no unique target is found an appropriate message is displayed to the admin.

Note
The pattern is first matched case insensitively against client names.
If no match is found it is matched against client authids. If still no
match is found and the pattern starts with '#' it is finally matched
against client userids.

Note
Since client names are matched by substring the pattern can potentially
match multiple targets. In that case the function will return 0 and ask
the admin to provide a unique pattern.

Note
The filtering flags are applied after the pattern matching has
finished. That means the pattern has to be unique against all clients
on the server even if some of them are not eligible.

Return
Client index, or 0 if no or multiple clients matched
> > > >