
Originally Posted by
Daedalus969
Actually, I was talking about this:

Download it, open the file called "init.lua" found in ShipmentDetector/lua/entities/gmod_wire_shipmentdetector/init.lua, and replace the code with this:
Code:
-- RP Shipment Detector by Briam (98% philxyz Money Detector)
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
ENT.WireDebugName = "Shipment Detector"
ENT.OverlayDelay = 0
/*---------------------------------------------------------
Name: Initialize
Desc: First function called. Use to set up your entity
---------------------------------------------------------*/
function ENT:Initialize()
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
local phys = self.Entity:GetPhysicsObject()
if phys:IsValid() then phys:Wake() end
-- Default range
self.range = 50
self.Inputs = Wire_CreateInputs(self.Entity, {"Range"})
self.Outputs = WireLib.CreateSpecialOutputs(self.Entity,{"Count", "Contents"},{"NORMAL", "STRING"})
end
/*---------------------------------------------------------
Name: TriggerInput
Desc: the inputs
---------------------------------------------------------*/
function ENT:TriggerInput(iname, value)
if iname == "Range" then
self.range = math.Clamp(value,0,500)
end
end
/*---------------------------------------------------------
Name: Think
Desc: Thinks :P
---------------------------------------------------------*/
function ENT:Think()
self.BaseClass.Think(self)
local distance = self.range
local count,contents = 0,""
local pos = self:GetPos()
for _,ent in ipairs(ents.GetAll()) do
if ent:GetClass() == "spawned_shipment" then
local dist = ent:GetPos():Distance( pos )
if dist <= distance then
count = ent.dt.count
contents = ent.dt.contents
distance = dist
end
end
end
Wire_TriggerOutput(self.Entity, "Count", count)
Wire_TriggerOutput(self.Entity, "Contents", contents)
self.Entity:NextThink(CurTime() + 2)
return true
end NOTE
This is untested. I just edited 2 lines of code so that they are the same as what Donkie did with my E2 function.
Line 55 and 56. I changed them FROM:
Code:
count = ent:GetNWInt("count")
contents = ent:GetNWString("contents") TO:
Code:
count = ent.dt.count
contents = ent.dt.contents
But hopefully it works.
Bookmarks