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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 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, }, }, } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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 |