Jump to content

[Help] How to i get command when onPlayerCommand?


ZeusXBr

Recommended Posts

  • Moderators
Posted

Your thread has been moved into a better section for receiving help with scripting :)

Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for a lifetime - Lao Tzu

Posted (edited)
-- (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

Previously known as MrTasty.

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...