Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSS[Any] Dynamic Selectors


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Dynamic Selectors

So I was bored this weekend and implemented dynamic target selectors, like Mincraft has them for SourceMod. This means there are now 4/5 new target selectors you can filter.

Last time something like this was attempted was with [Any] Dynamic Targeting, but this is quite a bit different. I guess they'd even somewhat work together.

I tested it in TF2 but it should work with any game.
  • @p Nearest player (sort=nearest,limit=1)
  • @r Random player (sort=random,limit=1)
  • @s Self (equal to @me, but filterable)
  • @!s Everyone but Self (equal to @!me, but filterable)
  • @a Everyone (no sorting or limit; equal to @all, but filterable)

These will populate the base list of targets that can then be filtered.


Filters are specified in square brackes and can not contains spaces, more square brackets, quotes, or argument/value separators.
Specify As many or little as you want, duplicate argument will use the last value.


Arguments available by default:
  • sort=Sorting Sorting being one of:
    • nearest, near Nearest players first
    • furthest, far Furthest players first
    • random, rng Random target sorting
    • arbitrary, any Undefined order
  • limit=Number Number of targets to return (positive integer)
  • c=Number combination of sort and limit
    • positive is nearest N players
    • positive is furthest -N players
  • r=Number Maximum distance to caller in HU
  • rm=Number Minimum distance to caller in HU
  • distance=Range Distance range to caller in HU
  • x=Range The targets x coordinate has to be within the range
  • y=Range The targets y coordinate has to be within the range
  • z=Range The targets z coordinate has to be within the range
  • dx=Range Distance between targets x and callers x has to be within range
  • dy=Range Distance between targets y and callers y has to be within range
  • dz=Range Distance between targets z and callers z has to be within range
  • team=Team Team specifyer (can be negated with ! prefix)
    • 0, none Unassigned
    • 1, spec Spectators
    • 2, T, RED, survivor, combine for Team 2
    • 3, CT, BLU, infected, rebel for Team 3
  • flag=Flags Check for all admin flags (can be negted with ! prefix)
  • hp=Range Target health has to be within range

Range values are formatted according to this list and can be negated using a ! prefix:
  • A literal value: attrib=100
  • An upper bound: attrib=..100
  • A lower bound: attrib=100..
  • Both bounds: attribg=-100..100

Example: sm_slay @a[rm=100,team=BLU]

Plugins can also register additional argument parsers with natives. Argument and value buffers are 64 bytes, so no super long stuff (as if that was affordable in chat anyways).
(API is untested, let me know if it's broken)
Code:

OnPluginStart() {
        DTS_RegisterTargetFilter("hp", dts_healthFilter);
}
OnPluginEnd() {
        DTS_DropTargetFilter();
}

bool dts_healthFilter(int caller, int target, const char[] key, const char[] value) {
        if (!IsClientInGame(target)) return false;
        int result = DTS_IntInRange(GetClientHealth(target), value);
        if (result == -1) {
                SetFilterError("Invalid value for argument 'hp', value or range expected!");
        return result == 1;
}



Attached Files
File Type: sp Get Plugin or Get Source (dynamic_selectors.sp - 21.3 KB)
File Type: inc dynamic_selectors.inc (4.6 KB)

Wyświetl pełny artykuł

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...