a0b8153f4b
Explanation: There are two clients in the server, one named gene, the other one "Ene ~special characters~". An admin issues "sm_slay Ene" and gets following error message: More than one client matched the given pattern. What this hack will do is: Use GetCmdArg(0, ...); to get the command name "sm_slay". Use GetCmdArgString(...); to get the arguments supplied to the command. Use GetLastProcessTargetString(...); (which was implemented in this commit) to retrieve the arguments that were passed to the last ProcessTargetString call. It will then pass this data to the DynamicTargeting plugin through its AmbiguousMenu native. The plugin will open up a menu on the client and list all targets which match the pattern that was supplied to ProcessTargetString. If the client selects a menu entry, FakeClientCommand will be used to re-execute the command with the correct target.
68 lines
1.7 KiB
Python
68 lines
1.7 KiB
Python
# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
|
|
import os
|
|
|
|
files = [
|
|
'adminhelp.sp',
|
|
'antiflood.sp',
|
|
'basecomm.sp',
|
|
'clientprefs.sp',
|
|
'nextmap.sp',
|
|
'reservedslots.sp',
|
|
'adminmenu.sp',
|
|
'basebans.sp',
|
|
'basetriggers.sp',
|
|
'funcommands.sp',
|
|
'nominations.sp',
|
|
'rockthevote.sp',
|
|
'admin-sql-prefetch.sp',
|
|
'basechat.sp',
|
|
'basevotes.sp',
|
|
'funvotes.sp',
|
|
'playercommands.sp',
|
|
'sounds.sp',
|
|
'admin-sql-threaded.sp',
|
|
'basecommands.sp',
|
|
'mapchooser.sp',
|
|
'randomcycle.sp',
|
|
'sql-admin-manager.sp',
|
|
'DynamicTargeting.sp'
|
|
]
|
|
|
|
spcomp_argv = [
|
|
os.path.join(builder.buildPath, SM.spcomp.binary.path),
|
|
'SM_GENERATED_BUILD=',
|
|
'-i' + os.path.relpath(os.path.join(builder.buildPath, 'includes'),
|
|
os.path.join(builder.buildPath, builder.buildFolder)),
|
|
'-i' + os.path.relpath(os.path.join(builder.sourcePath, 'plugins', 'include'),
|
|
os.path.join(builder.buildPath, builder.buildFolder)),
|
|
'-h',
|
|
'-E',
|
|
]
|
|
|
|
def build_plugin(script_path, smx_file):
|
|
inputs = [
|
|
SM.spcomp.binary,
|
|
script_path,
|
|
]
|
|
outputs = [
|
|
smx_file
|
|
]
|
|
argv = spcomp_argv + [script_path]
|
|
cmd_entry, (smx_entry,) = builder.AddCommand(
|
|
inputs = inputs,
|
|
argv = argv,
|
|
outputs = outputs,
|
|
dep_type = 'msvc',
|
|
weak_inputs = SM.generated_headers or []
|
|
)
|
|
SM.smx_files[smx_file] = smx_entry
|
|
|
|
for script_file in files:
|
|
script_path = os.path.join(builder.currentSourcePath, script_file)
|
|
smx_file = os.path.splitext(script_file)[0] + '.smx'
|
|
build_plugin(script_path, smx_file)
|
|
|
|
# This one has to be special.
|
|
build_plugin(os.path.join(builder.currentSourcePath, 'admin-flatfile', 'admin-flatfile.sp'),
|
|
'admin-flatfile.smx')
|