{"id":19952512,"url":"https://github.com/dosmike/sm-dynamicselectors","last_synced_at":"2026-01-31T20:38:08.778Z","repository":{"id":133520326,"uuid":"474706129","full_name":"DosMike/SM-DynamicSelectors","owner":"DosMike","description":"Target selector with Minecraft like arguments for SourceMod","archived":false,"fork":false,"pushed_at":"2025-01-02T18:12:25.000Z","size":32,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-04T19:54:30.679Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"SourcePawn","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DosMike.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-27T17:13:56.000Z","updated_at":"2025-01-02T18:10:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"8c47b684-9575-472d-9778-08ed5a50beb0","html_url":"https://github.com/DosMike/SM-DynamicSelectors","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/DosMike/SM-DynamicSelectors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DosMike%2FSM-DynamicSelectors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DosMike%2FSM-DynamicSelectors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DosMike%2FSM-DynamicSelectors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DosMike%2FSM-DynamicSelectors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DosMike","download_url":"https://codeload.github.com/DosMike/SM-DynamicSelectors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DosMike%2FSM-DynamicSelectors/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261749240,"owners_count":23203990,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T01:13:27.458Z","updated_at":"2026-01-31T20:38:08.727Z","avatar_url":"https://github.com/DosMike.png","language":"SourcePawn","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dynamic Selectors\n\nSo I was bored this weekend and implemented dynamic target selectors, like Mincraft has them for SourceMod.\nThis means there are now 4 new target selectors you can filter.\n\n* `@p` Nearest player (sort=nearest,limit=1)\n* `@r` Random player (sort=random,limit=1)\n* `@s` Self (equal to @me, but filterable)\n* `@!s` Everyone but Self (equal to @!me, but filterable)\n* `@a` Everyone (no sorting or limit; equal to @all, but filterable)\n\nThese will populate the base list of targets that can then be filtered.\n\nFilters are specified in square brackes and can not contains spaces, more square brackets, quotes, or argument/value separators.\nSpecify As many or little as you want, duplicate argument will use the last value.\n\nArguments available by default:\n\n* `sort=Sorting` Sorting being one of:\n  * `nearest`, `near` Nearest players first\n  * `furthest`, `far` Furthest players first\n  * `random`, `rng` Random target sorting\n  * `arbitrary`, `any` Undefined order\n* `limit=Number` Number of targets to return (positive integer)\n* `c=Number` combination of `sort` and `limit`\n  * positive is nearest N players\n  * positive is furthest -N players\n* `r=Number` Maximum distance to caller in HU\n* `rm=Number` Minimum distance to caller in HU\n* `distance=Range` Distance range to caller in HU\n* `x=Range` The targets x coordinate has to be within the range\n* `y=Range` The targets y coordinate has to be within the range\n* `z=Range` The targets z coordinate has to be within the range\n* `dx=Range` Distance between targets x and callers x has to be within range\n* `dy=Range` Distance between targets y and callers y has to be within range\n* `dz=Range` Distance between targets z and callers z has to be within range\n* `team=Team` Team specifyer (can be negated with ! prefix)\n  * `0`, `none` Unassigned\n  * `1`, `spec` Spectators\n  * `2`, `T`, `RED`, `survivor`, `combine` for Team 2\n  * `3`, `CT`, `BLU`, `infected`, `rebel` for Team 3\n* `flag=Flags` Check for all admin flags (can be negted with ! prefix)\n* `hp=Range` Target health has to be within range\n\nRange values are formatted according to this list and can be negated using a ! prefix:\n\n* A literal value: attrib=100\n* An upper bound: attrib=..100\n* A lower bound: attrib=100..\n* Both bounds: attribg=-100..100\n\n### Store selection\n\nIf a plugin appears to be broken when using a dynamic selector, or if you dont want to re-type\nthe selector every time you run a batch of commands, you can use `@selected` and `@macro`.\n\n`/macroselect` stores any arbitrary argument as target parameter, later accessible as `@macro`.\n`/select` will store the current set of matching players to reuse later with `@selected`.\n\nThe two use cases are random selections and negations. Using `@r` with `/macroselect` will pick\na new random player every call, it just stores `@r`. If you want everyone but staff for example,\nthis works better because it will retarget every time you run a command, even if players join or\nleave. `/select` on the other hand stores the set of players immediately, and `@selected` returns\nevery player from the time of selection, that is still on the server when running a command. So\n`@r` will behave consistently, but players joining after `/select` are never targeted with `@selected`.\n\n`/macroselect` and `/select` are by default accessible to everyone. For example:\n`sm_select @r[flag=!z]; sm_slay @selected`\n\nThis still uses target selectors, so you can't just make commands magically longer!\n\n### Plugin Devs\n\nPlugins can also register additional argument parsers with these natives:\n```php\nOnPluginStart() {\n\tDTS_RegisterTargetFilter(\"hp\", dts_healthFilter);\n}\nOnPluginEnd() {\n\tDTS_DropTargetFilter();\n}\n\nbool dts_healthFilter(int caller, int target, const char[] key, const char[] value) {\n\tif (!IsClientInGame(target)) return false;\n\tint result = DTS_IntInRange(GetClientHealth(target), value);\n\tif (result == -1) {\n\t\tSetFilterError(\"Invalid value for argument 'hp', value or range expected!\");\n\treturn result == 1;\n}\n```\n\nFull command example: `sm_slay @a[rm=100,team=BLU]`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdosmike%2Fsm-dynamicselectors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdosmike%2Fsm-dynamicselectors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdosmike%2Fsm-dynamicselectors/lists"}