I have tried everything, and it won't appear in my q list
Shared.lua -
[CODE]ENT.Base = "base_gmodentity" "
ENT.Type = "anim"
ENT.AutomaticFrameAdvance = true
ENT.Category = "Shop"
ENT.Spawnable = true
ENT.AdminSpawnable = true
ENT.ClassName = "Military Dealer"
function ENT:SetAutomaticFrameAdvance( bUsingAnim )
self.AutomaticFrameAdvance = bUsingAnim
end
[/CODE]
Init.lua -
[CODE]AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
function ENT:Initialize( )
self:SetModel( "models/humans/group01/female_01.mdl" )
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if(IsVaild(phys)) then
phys:Wake()
end
end
function ENT.SpawnFunction(ply,tr,ClassName)
if(!tr.Hit) then return end
local SpawnPos = ply:GetShootPos() + ply:GetForward()*80
local ent = ents.Create(ClassName)
ent:SetPos(SpawnPos)
ent:Spawn()
ent:Activate
return ent
end
function ENT:OnTakeDamage()
return false -- This NPC won't take damage from anything.
end
function ENT:AcceptInput( Name, Activator, Caller )
if Name == "Use" and Caller:IsPlayer() then
umsg.Start("ShopNPCUsed", Caller)
end
end
[/CODE]
Cl_Int.lua -
[CODE]include('shared.lua') -- At this point the contents of shared.lua are ran on the client only.
function ENT:Draw()
self:DrawModel()
end
function NPCShopMenu()
if (Menu == nil)then
Menu = vgui.Create( "DFrame" )
Menu:SetPos( 0, ScrH()/200)
Menu:SetSize(500, 1000)
Menu:SetTitle("Weapons Market")
Menu:SetDraggable(false)
Menu:ShowCloseButton(false)
Menu:SetDeleteOnClose(false)
Menu.Paint = function()
surface.SetDrawColor(75, 83, 32, 200)
surface.DrawRect(0,0,Menu:GetWide(),Menu:GetTall())
surface.SetDrawColor(40,40,40,255)
surface.DrawRect(0,24,Menu:GetWide(),1)
end
addButtons(Menu)
gui.EnableScreenClicker(true)
else
if(Menu:IsVisible())then
Menu:SetVisible(false)
gui.EnableScreenClicker(false)
else
Menu:SetVisible(true)
gui.EnableScreenClicker(true)
end
end
chat.AddText(Color(255,255,128), "Merchant: ",Color(255,255,255), "Welcome to my shop, how can I help you?" )
end
concommand.Add("open_game_menu", NPCShopMenu)
function CreateShopPanel()
local shopPanel = vgui.Create("ShopPanel", Menu)
local entityCatergory = vgui.Create("DCollapsibleCategory", shopPanel)
entityCatergory:SetPos(0,0)
entityCatergory:SetSize(shopPanel:GetWide(), 100)
entityCatergory:SetLabel("Entities")
local weaponCatergory = vgui.Create("DCollapsibleCategory", shopPanel)
weaponCatergory:SetPos(0,200)
weaponCatergory:SetSize(shopPanel:GetWide(), 100)
weaponCatergory:SetLabel("Weapons")
local entityList = vgui.Create("DIconLayout", entityCatergory)
entityList:SetPos(0,20)
entityList:SetSize(entityCatergory:GetWide(), entityCatergory:GetTall())
entityList:SetSpaceY(5)
entityList:SetSpaceX(5)
local weaponList = vgui.Create("DIconLayout", weaponCatergory)
weaponList:SetPos(0,20)
weaponList:SetSize(weaponCatergory:GetWide(), weaponCatergory:GetTall())
weaponList:SetSpaceY(5)
weaponList:SetSpaceX(5)
for k,v in pairs(OWC.Config.SHOP.entsArr)do
local icon = vgui.Create("SpawnIcon", entityList)
icon:SetModel(v[1])
icon:SetToolTip(v[3].."\nCost: "..v[4])
entityList:Add(icon)
icon.DoClick = function(icon)
net.Start("buy_entity")
net.WriteInt(k,32)
net.SendToServer()
end
end
for k,v in pairs(OWC.Config.SHOP.weaponsArr)do
local icon = vgui.Create("SpawnIcon", weaponList)
icon:SetModel(v[1])
icon:SetToolTip(v[3].."\nCost: "..v[4])
weaponList:Add(icon)
icon.DoClick = function(icon)
net.Start("buy_gun")
net.WriteInt(k,32)
net.SendToServer()
end
end
return shopPanel
end
usermessage.Hook("ShopNPCUsed", NPCShopMenu)[/CODE]
[lua]ENT.Base = "base_gmodentity" "[/lua] to [lua]ENT.Base = "base_gmodentity"[/lua] 1st line shared.lua
[QUOTE=rtm516;50551177][lua]ENT.Base = "base_gmodentity" "[/lua] to [lua]ENT.Base = "base_gmodentity"[/lua] 1st line shared.lua[/QUOTE]
Fixed, but still not working
Sorry, you need to Log In to post a reply to this thread.