• Running Commands via NPC
    0 replies, posted
Hi, So I'm attempting to run commands from addons via a NPC. My current .lua's are pretty much cut and paste from others and I've just done trial and error trying to get this console command to run. Here are my three files: shared.lua ENT.Type   = "ai" ENT.Base   = "base_ai" ENT.PrintName   = "gLevel NPC" ENT.Author   = "N/A" ENT.Purpose       = "To open gLevel" ENT.Spawnable   = true ENT.AdminSpawnable   = false init.lua AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") function ENT:Initialize() self:SetModel("models/player/kleiner.mdl") self:SetHullType( HULL_HUMAN ) self:SetHullSizeNormal( ) self:SetNPCState( NPC_STATE_SCRIPT ) self:SetSolid(  SOLID_BBOX ) self:CapabilitiesAdd( CAP_ANIMATEDFACE, CAP_TURN_HEAD ) self:SetUseType( SIMPLE_USE ) self:DropToFloor()   self:SetMaxYawSpeed( 90 ) end function ENT:OnTakeDamage() return false end  function ENT:AcceptInput(name, activator, caller) if name == "Use" and caller:IsPlayer() then RunConsoleCommand("gLevel.openMenu") end end cl_init.lua include("shared.lua") function ENT:Draw() self:DrawModel() end Again, a lot is cut and paste. In the above I'm attempting to open the gLevel menu from the addon, gLevel. It says its an "unknown command" so I assume RunConsoleCommand might only work with traditional commands and none from addons? If this is so, how do I go about achieving: A user pressing E (use) on a NPC and it opens up the menu from gLevel. I have seen this accomplished on other servers (even with gLevel) and assumed it was via NPC, but if its another addon I need that does this please do let me know. Thanks!
Sorry, you need to Log In to post a reply to this thread.