09-12-2014, 05:59 AM
(09-12-2014, 05:04 AM)Lo_Pan Wrote: Player "myplayername" tried to execute command "/j" that was stopped by the HOOK_EXECUTE_COMMAND hook
function Initialize(Plugin) Plugin:SetName("STONED") Plugin:SetVersion(1) -- Hooks cPluginManager:AddHook(cPluginManager.HOOK_EXECUTE_COMMAND, RollJoint); PLUGIN = Plugin -- Command Bindings cPluginManager.BindCommand("/j", "STONED.j", RollJoint, " - is rolling a joint."); -- RollJoint binding LOG("Initialised " ..Plugin:GetName() .. " v." .. Plugin:GetVersion()) return true end function OnDisable() LOG(PLUGIN:GetName() .. " is shutting down.") end -- Default callback name is: function OnExecuteCommand(Player, Command) -- RollJoint Command: function RollJoint(Player, j) SendMessage(Player, " " .. Player:GetName(Player) .. " is rolling a joint.") return true end
Why do you use the same function for a Hook and a command?
It is called first from the hook, then you after sending the message to the player, you are returning "true", which means "hook successfully executed", if you want that the command get executed, you have to return "false".