So what I’m trying to do is when you hit e on the panel you wait 10 mins before you can use it again. Iv tried using timers but I’ve got so close and I just can’t wrap my mind around how to do this.
So these are the 2 entities.
Entity 1 (“Panel”)
Description: Hit e and it sends the networking to the NPC Block and spawns the NPCs at all the blocks.
init.lua
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetModel("models/cire992/props/locker02.mdl")
self:SetUseType(SIMPLE_USE)
self:SetSolid(SOLID_VPHYSICS)
self:DropToFloor()
end
function ENT:AcceptInput(name, activator, caller)
if name == "Use" and caller:IsPlayer() then
print("OK")
timer.Create("slow", 2, 1, function()
net.Start("spawn_npcs")
net.Send( activator )
timer.Pause("slow")
end)
timer.Create("cooldown", 600, 1, function()
timer.Start("slow")
print("STARTING THE THING")
end)
end
end
Entity 2 (“NPC Block”)
Description: When it receives the networking it spawns the NPCs at all blocks at once
init.lua
AddCSLuaFile("shared.lua")
include("shared.lua")
local CFG = CFG
function ENT:Initialize()
self:SetModel("models/hunter/blocks/cube025x025x025.mdl")
self:SetUseType(SIMPLE_USE)
self:SetSolid(SOLID_BBOX)
self:DropToFloor()
end
function ENT:Think()
net.Receive( "sending_to_server", function( len, pl )
for k, v in pairs( ents.FindByClass( "npc_block" ) ) do
v:SetSolid(SOLID_NONE)
local npc_spawn_spot = v:GetPos()
local NPC_TRAINING_DROID = ents.Create( "npc_combine_s" )
if ( !IsValid( NPC_TRAINING_DROID ) ) then return end
NPC_TRAINING_DROID:SetModel("models/tfa/comm/gg/npc_reb_sw_t_droid_b1.mdl")
NPC_TRAINING_DROID:Give("npc_sw_weapon_752_e5")
NPC_TRAINING_DROID:SetPos( npc_spawn_spot )
NPC_TRAINING_DROID:Spawn()
end
end)
end
EDIT: P.S. ignore the prints they helped me see if the networking was even working and if the whole thing was coming together.