Jump to content

Custom command


ShaDoW

Recommended Posts

  • Management

Here is something similar to what you asked. It doesn't intercept !levlist command from chat but instead it will intercept the /levlist console command. Adding the code into a levlist.lua file in the server silent folder. Add the file name in lua_modules like this: set lua_modules "levlist.lua". Once the server starts it will load the Lua modules. You can add many modules into the lua_modules string.

 

-- function body taken from the rules.lua from N!trox
function et_ClientCommand(clientNum, command)
command = string.lower(command)
 --If a client types "/levlist" in his console
 if (command == "levlist") then
  et.trap_SendServerCommand(clientNum, "chat \""Level 0 - Guest"^7\n\"")
  et.trap_SendServerCommand(clientNum, "chat \""Level 1 - Regular"^7\n\"")
  return 1
 end
end

 

I didn't test the above but it is an example how to use Lua. More Lua documentation http://mygamingtalk.com/wiki/index.php/Silent_Mod_Server_Cvar#Lua and more detailed documentation in the server.html which came with the silent download.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...