The error is:
[CODE][ERROR] addons/firearmdealer/lua/autorun/sv_mainnpc.lua:20: attempt to call field 'AddNetworkString' (a nil value)
1. unknown - addons/firearmdealer/lua/autorun/sv_mainnpc.lua:20[/CODE]
MyCode:
[CODE]function spawnNPC()
--> Dealer
local npc = ents.Create("base_ai")
npc:SetPos( NPCPos + Vector(0, 0, 10))
npc:SetAngles( NPCAng )
npc:SetModel( NPCModel )
npc:SetHullType(HULL_HUMAN)
npc:SetHullSizeNormal()
npc:SetNPCState(NPC_STATE_SCRIPT)
npc:SetSolid(SOLID_BBOX)
npc:CapabilitiesAdd(bit.bor(CAP_ANIMATEDFACE, CAP_TURN_HEAD))
npc:SetUseType(SIMPLE_USE)
npc:Spawn()
npc:DropToFloor()
--> Input
function npc:AcceptInput(name, activator, caller)
if name == "Use" and IsValid(caller) then
net.Start("MelonosPanel")
net.WriteInt(1)
net.Send(caller)
end
end
end
hook.Add("InitPostEntity", "Melonos.spawnNPC", spawnNPC)
[/CODE]
The file sv_mainnpc is running shared. It should be in lua/autorun/server/sv_mainnpc.lua
You have the file as a shared file, and util.AddNetworkString is a serverside function. Just make the file serverside only, and you should be set.
Sorry, you need to Log In to post a reply to this thread.