Invalid handler with info.lua
#1
I have been experimenting with the info.lua file and am now stuck at one point where it says "Invalid handler for command /ping, command will not be registered." I have added the handler for the command as "PingPlayer" and written the handler out in ping.lua. Below I added my info.lua and ping.lua files. (Note: all other commands + Handlers work). What's the issue? Thanks.
INFO.LUA
g_PluginInfo =
{
  Name = "Basics",
  Version = "0.1",
  Description = "Adds some basic commands",

  Commands =
  {
    ["/heal"] =
    {
      Permission =  "basic.heal",
      HelpString =  " Heal player to full health.",
      Handler =  HealPlayer,
    },

    ["/ping"] =
    {
      Permission =  "basic.ping",
      HelpString =  " Get a players ping to the server.",
      Handler =  PingPlayer,
    },

    ["/feed"] =
    {
      Permission =  "basic.feed",
      HelpString =  " Feed player to full hunger.",
      Handler =  FeedPlayer,
    },
  },
}

ping.lua
function PingPlayer(Split, Player)
  if Split[2] == nil then
    Player:SendMessageSuccess(Player:GetClientHandle():GetPing())
  elseif(Player:HasPermission("basics.ping.other")) then
    local Ping = function(OtherPlayer)
      if (OtherPlayer:GetName() == Split[2]) then
        Player:SendMessageSuccess("Player " .. Split[2].."ping: " .. OtherPlayer:GetClientHandle():GetPing())
        return true
      end
    end
    if (not(cRoot:Get():FindAndDoWithPlayer(Split[2], Ping))) then
      Player:SendMessageFailure("Player not found.")
    end
  end
  return true
end
Reply
Thanks given by:


Messages In This Thread
Invalid handler with info.lua - by gv1222 - 06-22-2014, 10:20 AM
RE: Invalid handler with info.lua - by xoft - 06-22-2014, 07:11 PM
RE: Invalid handler with info.lua - by gv1222 - 06-23-2014, 12:04 AM
RE: Invalid handler with info.lua - by xoft - 06-23-2014, 04:48 AM
RE: Invalid handler with info.lua - by worktycho - 06-23-2014, 07:14 AM



Users browsing this thread: 2 Guest(s)