I have a bank addon and I can spawn the bank npc in with commands but the lua code wont spawn it in here is the code.
the map is rp_evocity_v2d
part that spawns the entity in
[CODE]hook.Add("Initialize", "bankandrobbingspawns", function()
print("Bank Attempted to spawn!")
local ent = ents.Create("bank_npc") -- This creates our zombie entity
ent:SetPos(Vector(-6602.371094, -7730.229492, 72.031250))
ent:Spawn()
end)[/CODE]
Here is the entities code
[CODE]AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
util.AddNetworkString("startbank")
function ENT:Initialize()
self:SetModel("models/Characters/hostage_04.mdl")
self:SetSequence(self:LookupSequence("LineIdle03"))
self:SetPlaybackRate( 1 )
self:SetCollisionGroup(COLLISION_GROUP_NONE)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
local phys = self:GetPhysicsObject()
if phys:IsValid() then
phys:EnableMotion(false)
--phys:Wake()
end
end
function ENT:Use(activator, caller)
net.Start("startbank")
net.Send(caller)
end
[/CODE]
Can anyone help?
change
[lua]hook.Add("Initialize", "bankandrobbingspawns", function()[/lua]
to
[lua]hook.Add("InitPostEntity", "bankandrobbingspawns", function()[/lua]
Sorry, you need to Log In to post a reply to this thread.