Jump to content

[Help] How to i get command when onPlayerCommand?


ZeusXBr

Recommended Posts

-- (server side)
function onPlayerCommandHandler(cmd)
  local playername = getPlayerName(source)
  outputChatBox(playername .. " entered command " .. cmd, root, 255, 0, 0)
end
addEventHandler("onPlayerCommand", root, onPlayerCommandHandler)

source is the element of the player that entered the command, you can get the name using getPlayerName; the first parameter passed to the handler function is the command string that was entered.

Edited by Addlibs
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...