(09-12-2014, 08:34 AM)LO1ZB Wrote: When you change the name of the function, which is called in the hook, you have to create a function with that name.
Right, so, the name of the function in the hook is the same as the actuall function, which I have done but still it fails. See code bellow
The hook is PluginInfo and the function is PluginInfo, so that should be right then, right?!
-- This will initialize the plugin to the server.
function Initialize(Plugin)
Plugin:SetName("STONED")
Plugin:SetVersion(1)
-- Hooks
cPluginManager:AddHook(cPluginManager.HOOK_EXECUTE_COMMAND, PluginInfo);
cPluginManager:AddHook(cPluginManager.HOOK_EXECUTE_COMMAND, RollJoint);
cPluginManager:AddHook(cPluginManager.HOOK_EXECUTE_COMMAND, SmokeJoint);
PLUGIN = Plugin
-- Command Bindings
cPluginManager.BindCommand("/pi", "STONED.pi", PluginInfo, " - display plugin version."); -- PluginInfo binding
cPluginManager.BindCommand("/j", "STONED.j", RollJoint, " - player is rolling a joint."); -- RollJoint binding
cPluginManager.BindCommand("/l", "STONED.l", SmokeJoint, " - player is smoking a joint."); -- SmokeJoint binding
LOG("Initialised " ..Plugin:GetName() .. " v." .. Plugin:GetVersion())
return true
end
function OnDisable()
LOG(PLUGIN:GetName() .. " is shutting down!")
end
-- Commands
-- PluginInfo
function PluginInfo(Player, pi)
Player:SendMessage("§eSTONED v1.0.0.3")
return false
end
-- RollJoint:
function RollJoint(Player, j)
cRoot:Get():BroadcastChat("§b" .. Player:GetName() .. " is rolling a joint.")
return false
end
-- SmokeJoint:
function SmokeJoint(Player, l)
cRoot:Get():BroadcastChat("§b" .. Player:GetName() .. " is smoking a joint.")
return false
end


