[color=blue][size=24]Player Management[/size][/color]
Posted by [color=red]aDz[/color] @ [color=green]15/06/2009[/color]
[size=18][color=blue]Description[/color][/size]
Allows clients/admins (configurable) to manage target(s).
The target can be any of the following:
- A player's name
- A player's partial name
- A player's steamid
- A player's userid
& script also works with playerlib filters, i.e you can manage an entire team / state etc.
The management can be done via a popup menu where an action can be performed on a single player / an entire team or everybody, this menu is:
"<commandPrefix>players" where the command prefix by default is "@"
It is also possible to directly perform an action on a given target or filter. The syntax and usage of that is as follows:
[code]Syntax = <commandPrefix<commandName>> <playerFilters/targetName/targetSteamid/targetUserid>[/code]
i.e:
"@slay aDz"
There are tell messages that manage each incorrect argument individually to ensure that the script is informative.
[size=18][color=blue]Requirements[/color][/size]
- EventScripts v2.0.0.250i -> [url=http://mattie.info/cs]Mattie's Download Page[/url]
- Authorization Service -> [url=http://eventscripts.com/pages/basic_auth]Basic_Auth[/url] (Will work with others of course, GROUP = "giveCommand")
Installation
[size=18][color=blue]Installation[/color][/size]
[color=green]Automatic [/color]
-> es_install playerManagement -autoload
-> Add the following line to your .../<gameDir>/cfg/autoexec.cfg:
:: es_load playerManagement
-> Alternatively to load manually:
:: rcon es_load playerManagement
-> Restart your server
[color=green]Manual [/color]
-> Extract Downloadable .zip file to .../<gameDir>/
-> Add the following line to your .../<gameDir>/cfg/autoexec.cfg:
:: es_load playerManagement
-> Alternatively to load manually:
:: rcon es_load playerManagement
-> Restart your server
[size=18][color=blue]Configuration[/color][/size]
This configuration file is created when the script is first loaded.
[code]// Player Management [v1.0] Configuration
// General Settings
// Admin Only (Boolean) [Default=1]
playerManagement_adminOnly 1
// Command Prefix (String) [Default="@"]
playerManagement_commandPrefix "@"
// Announce Action (Boolean) [Default=1]
playerManagement_announceAction 1
// Syntax Message (String) [Default="Syntax = <actionCommand> <playerFilters/targetName/targetSteamid/targetUserid>"]
playerManagement_syntaxMessage "Syntax = <actionCommand> <playerFilters/targetName/targetSteamid/targetUserid>"[/code]
Edit it to your liking.
In addition to this, there is extra configuration that can be done in order to add other actions to the menu / command usage. This is mainly aimed at experienced users, however it's very simple to do with a little python knowledge, i've coded it in such a way that you can add extra facilities. To add an extra facility, you [b]MUST[/b] follow the following steps:
1) Add the action name (titled) to the actionList. Please follow the format of the current list, whereby the action is alphabetical, on a new line, encased within string marks: "" and ends with a comma (unless it is the last item of course).
Note: This action name will also have a function that will be in lower case form, also beware functions cannot have spaces and therefore nor can your action name. If there is more than 1 word, please join with an underscore (_).
2) Create the function name in the revelent section of the script whereby it is the lower case form.
i.e: The action name, "Burn" has a function called burn.
i.e: An action name called "Slap_Player" would have a function name called slap_player
3) In regards to that function, by default it has 2 paramters, the userid of the player initiating the action and the target's id being the receiving player (the functions are executed once per player even with filters). Please follow the format of the functions already, but it goes something like this:
[syntax="python"]def <functionName>(userid, target):
if target in playerlib.getUseridList("#<filterName>"):
<actionCommand> # Playerlib or otherwise
if announceAction:
msg("%s <actionVerb> %s" %(es.getplayername(userid), es.getplayername(target)))[/syntax]
Let's do a quick example, how about putting a player in noclip? You would add Noclip to the list so it looks something like this (just an example with no additional features [v1.0]):
[syntax="python"]actionList = [
"Burn",
"Extinguish",
"Freeze",
"Godmode",
"Kick",
"Mortal",
"Noclip", # Here we added it, on it's new line encased within "" with a proceeding comma (,)
"Slay",
"Spectator",
"Swap",
"Unfreeze"][/syntax]
Our function would then probably look something like:
[syntax="python"]def noclip(userid, target):
if target in playerlib.getUseridList("#alive"):
playerlib.getPlayer(target).noclip(1)
if announceAction:
msg("%s put %s into noclip mode" %(es.getplayername(userid), es.getplayername(target)))[/syntax]
Note: with noclip, you probably want an additional function to "un-noclip" a user. If you wanted to, you could add the following line into the mortal function so it covers "un-noclip"-ing aswell as "un-godmode"-ing!
[syntax="python"]playerlib.getPlayer(target).noclip(0)[/syntax]
You would add this under the other .godmode(0) line.
NOTE: Before anyone makes a suggestion regarding why not have toggle features so the script remembers freeze/unfreeze, this is deliberate, there is nothing worse than freezeing a single player then wanting to freeze the team, so for ease of use, you use my handy freeze all filter but then end up unfreezing the individual you already froze!
Enjoy!
[size=18][color=blue][url=http://addons.eventscripts.com/addons/view/playerManagement]Download playerManagement[/url][/color][/size]
+w00t
Version Notes For 1.0
Updated on: 2009-06-22 13:46:01 EST by Adz (View Zip Contents)
Allows clients/admins (configurable) to manage target(s).