Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google Log In with Steam Sign In
  • Create Account
Photo

Custom command


  • Please log in to reply
8 replies to this topic

#1
OFFLINE   ShaDoW

ShaDoW

    Member

  • Members
  • PipPip
  • 41 posts
1
A step in the right direction
Hello,

I want to make a custom command !levlist. It must show a list of adminlevels like in other mods. But i don't know how to start a new line. I tried "/n" already but it doesn't work.
Can u help me?

greetz shadow

#2
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland
You could make all of the lines separated prints.

#3
OFFLINE   ShaDoW

ShaDoW

    Member

  • Members
  • PipPip
  • 41 posts
1
A step in the right direction
How do u mean?

#4
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland
exec = chat "Level 0 - Guest"; chat "Level 1 - Regular";

#5
OFFLINE   ShaDoW

ShaDoW

    Member

  • Members
  • PipPip
  • 41 posts
1
A step in the right direction
Okay thanks it works! Do u know also how to sent it alone to the user of the command. That it isn't visible in mainchat.

#6
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland
You could do that with Lua but not with custom commands.

#7
OFFLINE   ShaDoW

ShaDoW

    Member

  • Members
  • PipPip
  • 41 posts
1
A step in the right direction
hm don't know how lua works. Is it hard? :D

#8
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland
It's not hard. But I don't have any examples I could post. Let's hope if someone who uses it more has something they could post to base the script on.

#9
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland
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....Server_Cvar#Lua and more detailed documentation in the server.html which came with the silent download.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users