I can't create any commands.
#5
Hey guys,

First of all, C++ server, Awesome!

Now for my problem,

I seem to have the same errors, but fixing it as detailed above didn't help.
Trying to get a simple command going, but my Lua knowledge is limited.

Here is the code: "As I originaly figured it should work"
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

And here is the drama the console gave me:

--Warn [21:43:59] LUA: Plugins/STONED/stoned.lua:31: attempt to call global 'SendMessage' (a nil value)
--Warn [21:43:59] Stack trace:
--Warn [21:43:59] Plugins/STONED/stoned.lua(31): (no name)
--Warn [21:43:59] Stack trace end
--Warn [21:43:59] Error in plugin STONED calling function <callback>()
--Warn [21:43:59] LUA: Plugins/STONED/stoned.lua:31: attempt to call method 'GetName' (a nil value)
--Warn [21:43:59] Stack trace:
--Warn [21:43:59] Plugins/STONED/stoned.lua(31): (no name)
--Warn [21:43:59] Stack trace end
--Warn [21:43:59] Error in plugin STONED calling function <callback>()[/php]

Tried changing SendMessage to Player:SendMessage and the other solutions pointed out in the post above..
What am I overlooking here?
Reply
Thanks given by:


Messages In This Thread
I can't create any commands. - by Guandor - 09-06-2014, 12:09 PM
RE: I can't create any commands. - by Seadragon91 - 09-06-2014, 02:42 PM
RE: I can't create any commands. - by xoft - 09-06-2014, 06:49 PM
RE: I can't create any commands. - by Guandor - 09-07-2014, 04:42 AM
RE: I can't create any commands. - by Lo_Pan - 09-12-2014, 03:49 AM
RE: I can't create any commands. - by NiLSPACE - 09-12-2014, 03:55 AM
RE: I can't create any commands. - by Lo_Pan - 09-12-2014, 03:58 AM
RE: I can't create any commands. - by Seadragon91 - 09-12-2014, 04:47 AM
RE: I can't create any commands. - by Lo_Pan - 09-12-2014, 05:04 AM
RE: I can't create any commands. - by LO1ZB - 09-12-2014, 05:59 AM
RE: I can't create any commands. - by Lo_Pan - 09-12-2014, 07:15 AM
RE: I can't create any commands. - by LO1ZB - 09-12-2014, 07:36 AM
RE: I can't create any commands. - by Lo_Pan - 09-12-2014, 08:24 AM
RE: I can't create any commands. - by LO1ZB - 09-12-2014, 08:34 AM
RE: I can't create any commands. - by Lo_Pan - 09-12-2014, 08:52 AM
RE: I can't create any commands. - by LO1ZB - 09-12-2014, 09:25 AM
RE: I can't create any commands. - by Seadragon91 - 09-12-2014, 06:22 AM
RE: I can't create any commands. - by xoft - 09-12-2014, 07:37 PM
RE: I can't create any commands. - by xoft - 09-12-2014, 07:39 PM
RE: I can't create any commands. - by xoft - 09-12-2014, 07:45 PM
RE: I can't create any commands. - by Lo_Pan - 09-13-2014, 12:16 AM



Users browsing this thread: 1 Guest(s)