Repository navigation
Add new command.
This How-To will show you how to script a new command for your players.
First create a new Script in the directory, where your scripts are and add this script in your index.cml (see also Change already existing Wolfpack scripts without touching standard scripts). To script the new command you need to do 2 things:
First you have to script the command using a method with the prototype
def mycommand(socket, command, arguments):
Second you have to register this method for the commandname. You do this by calling the wolfpack.register method in the onLoad Event of your script.
This Example shows you a command with the name "online". When used it tells the player how many players are currently connected to the server:
def command_online(socket, command, arguments):
socket.sysmessage('There are currently %d Players online'%wolfpack.playercount() )
def onLoad():
wolfpack.registercommand( 'online', command_online)
When the command is scripted, you need to add this command to the Player-ACL (Access Control List), otherwise the server will block access to this command to any Account below GM-status.
Edit "definitions\system\access.xml" and search for <acl id="player" rank="1"></acl>. In the command-group add this line:
<action name="online" permit="true" />