this code can be cause overflow? (not enough memory error in a few hours)
6 replies, posted
cl_init.Lua
function ENT:Init()
local ply = LocalPlayer()
local mark = {}
local ent = ClientsideModel("models/hunter/plates/plate1x1.mdl",RENDERGROUP_OPAQUE)
ent:SetPos(ply:GetPos() + Vector(0,0,40))
ent:SetAngles(ply:GetAngles())
ent:SetRenderBounds(Vector(-1,-1,-1)*500000,Vector(1,1,1)*500000)
ent.ply = ply
function ent:RenderOverride()
local boneindex = ply:LookupBone("ValveBiped.Bip01_Head1")
if boneindex and ply:GetBoneMatrix(boneindex) then
local headpos, headang = ply:GetBoneMatrix(boneindex):GetTranslation(), ply:GetBoneMatrix(boneindex):GetAngles()
local ang = headang
ang:RotateAroundAxis(headang:Right(),-90)
ang:RotateAroundAxis(headang:Forward(),-14.3)
self:SetPos(headpos + headang:Right() * 1 + headang:Up() * 2.9)
self:SetAngles(ang)
self:DrawModel()
end
end
table.insert(mark,ent)
local ent = ClientsideModel("models/hunter/plates/plate1x1.mdl",RENDERGROUP_OPAQUE)
ent:SetPos(ply:GetPos() + Vector(0,0,40))
ent:SetAngles(ply:GetAngles())
ent:SetRenderBounds(Vector(-1,-1,-1)*500000,Vector(1,1,1)*500000)
ent.ply = ply
function ent:RenderOverride()
local boneindex = ply:LookupBone("ValveBiped.Bip01_Neck")
if boneindex and ply:GetBoneMatrix(boneindex) then
local headpos, headang = ply:GetBoneMatrix(boneindex):GetTranslation(), ply:GetBoneMatrix(boneindex):GetAngles()
local ang = headang
ang:RotateAroundAxis(headang:Right(),-45)
ang:RotateAroundAxis(headang:Forward(),-60)
self:SetPos(headpos + headang:Right() * 5 + headang:Up() * -5)
self:SetAngles(ang)
self:DrawModel()
end
end
table.insert(mark,ent)
local ent = ClientsideModel("models/hunter/plates/plate1x1.mdl",RENDERGROUP_OPAQUE)
ent:SetPos(ply:GetPos() + Vector(0,0,40))
ent:SetAngles(ply:GetAngles())
ent:SetRenderBounds(Vector(-1,-1,-1)*500000,Vector(1,1,1)*500000)
ent.ply = ply
function ent:RenderOverride()
local boneindex = ply:LookupBone("ValveBiped.Bip01_R_Hand")
if boneindex and ply:GetBoneMatrix(boneindex) then
local headpos, headang = ply:GetBoneMatrix(boneindex):GetTranslation(), ply:GetBoneMatrix(boneindex):GetAngles()
local ang = headang
ang:RotateAroundAxis(headang:Right(),-45)
ang:RotateAroundAxis(headang:Forward(),-60)
self:SetPos(headpos + headang:Right() * 5 + headang:Up() * -5)
self:SetAngles(ang)
self:DrawModel()
end
end
table.insert(mark,ent)
local ent = ClientsideModel("models/hunter/plates/plate1x1.mdl",RENDERGROUP_OPAQUE)
ent:SetPos(ply:GetPos() + Vector(0,0,40))
ent:SetAngles(ply:GetAngles())
ent:SetRenderBounds(Vector(-1,-1,-1)*500000,Vector(1,1,1)*500000)
ent.ply = ply
function ent:RenderOverride()
local boneindex = ply:LookupBone("ValveBiped.Bip01_L_Hand")
if boneindex and ply:GetBoneMatrix(boneindex) then
local headpos, headang = ply:GetBoneMatrix(boneindex):GetTranslation(), ply:GetBoneMatrix(boneindex):GetAngles()
local ang = headang
ang:RotateAroundAxis(headang:Right(),-45)
ang:RotateAroundAxis(headang:Forward(),-60)
self:SetPos(headpos + headang:Right() * -5 + headang:Up() * -5)
self:SetAngles(ang)
self:DrawModel()
end
end
table.insert(mark,ent)
self.mark = mark
end
function ENT:Think()
return true
end
function ENT:OnRemove()
for k, v in pairs(self.mark) do
SafeRemoveEntity(v)
end
end
this code can be cause overflow?
my server often down in a few hours.
with this error (not enough memory)
but my computer RAM Is 32Gb RAM..
It's a client-side code, I don't think it can overflow server's memory
That's an awful code that for some reason spawns 4 plates in the same position and angle...Also you can have a 128 cores and 256gb ram, and it will still working like shit, because srcds is single core and only can use 3.2gb ram
hm.. okay i'll find another code for fixing not enough memory error
it isn't same position and angles.
Sorry, you need to Log In to post a reply to this thread.