• Need someone to help complete a cooldown system within the next 24 hours
    9 replies, posted
I've got a time crunch due to an eviction lmao, and I just need someone to work me through a cooldown system. I've looked for hours and have made some progress so if you wanna jump onboard this pain-train I would greatly appreciate it. I can give more details as people ask - tell me what you need - will also include credits for help in the addon no garuntee it will be put on the workshop but I will send you the finished product if you want. Just need help from the community, am quite the noob. Ty to anyone that can help.
I just need someone to tell me what I'm doing wrong. //CL net.Receive("purge_start", function() purgestarttime = net.ReadInt(32) purgestart = true end) net.Receive("purgeCD", function() purgeendtime = net.ReadInt(32) purgecool = true end) function ENT:Draw() self:DrawModel() if purgestart == true then local remaining = purgestarttime - CurTime() hours = math.floor(remaining/3600) minutes = math.floor(remaining/60 - hours*60) seconds = math.floor(remaining - hours*3600 - minutes*60)     cam.Start3D2D(self:LocalToWorld(Vector(1,-113,60)),self:LocalToWorldAngles(Angle(0,90,90)), .4)             draw.RoundedBox(0,0,0,580,320,Color(15,15,15))             draw.DrawText(minutes..":"..seconds,"Whatever",290,80,Color(120,120,120),1,1)             cam.End3D2D()             if remaining <= 0 then local remaining2 = purgeendtime - CurTime() bhours = math.floor(remaining2/3600) bminutes = math.floor(remaining2/60 - bhours*60) bseconds = math.floor(remaining2 - bhours*3600 - bminutes*60)     cam.Start3D2D(self:LocalToWorld(Vector(1,-113,60)),self:LocalToWorldAngles(Angle(0,90,90)), .4)             draw.RoundedBox(0,0,0,580,320,Color(15,15,15))             draw.DrawText(bminutes..":"..bseconds,"Whatever",290,80,Color(120,120,120),1,1)             cam.End3D2D()         end     end end //SV AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") util.AddNetworkString("purge_start") util.AddNetworkString("purge_end") util.AddNetworkString("purgeCD") function ENT:Initialize()     self:SetModel("models/props/cs_assault/Billboard.mdl")     self:PhysicsInit(SOLID_VPHYSICS)     self:SetMoveType(MOVETYPE_VPHYSICS)     self:SetSolid(SOLID_VPHYSICS)     self:Activate()     local phys = self:GetPhysicsObject()     if phys:IsValid() then         phys:Wake()     end purgeST() end function purgeST() net.Start("purge_start") net.WriteInt(CurTime()+60,32) net.Broadcast() end     timer.Create("purgestarttimer",60, 0, function()     purgebreak()     end) function purgebreak() net.Start("purgeCD") net.WriteInt(CurTime()+30,32) net.Broadcast()     timer.Create("purgecooldown",30, 0, function()     purgeST()     end) end The point is to create a loop for the draw function to go off of. But it keeps dropping off after purgeCD/purgebreak. I know the Clientside isn't right but I don't know why or how to fix it.
You're going to need to be much more specific, what do you mean by 'dropping off'? Screenshots, code errors are a must.
It's definitely more of a preference than a requirement, and I realize it seemed a bit pushy which is why the snip is there and because the original comment was rushed. I wanted to give a more thorough code with my second reply. Essentially it goes through the first timer "purgeST" just fine (60 mins on the billboard entity) then after about 50 seconds (sometimes the numbers disappear 7-10 seconds early give or take), then the next timer displays (30 seconds). It counts down to 0 and then suddenly changes to -29:1867... instead of looping back to the 60 minute timer. No errors in console.
In `purgebreak` do you intend to create the `purgecooldown` timer to run every 30s from then on? You probably want to use `timer.Simple` so that it only executes once, otherwise it will be continually cooling down the purge every 30s and intersecting with your start timer.
No those were two unintentional mistakes which I've now fixed so thank you Inbetween the timer's it flashes "59:59" for a split second before the correct time is displayed. Is this just a glitch or can it be fixed?
I'm not really sure what you're trying to achieve, you set `purgecool` to true but you never use the value. I wouldn't use net messages to network this sort of data, just use CurTime which is synchronised on the client anyway. Is the billboard entity spawned when the map loads? If so you don't need any networking and I wouldn't start the purge in `ENT:Initialize`, since you won't be able to spawn multiple billboards.
I ended up using purgecool but now I'm trying to add emitsound to PurgeST but don't know how. Can anyone help?
You can either emit a 3D sound on the entity, works on server and client: billboardEnt:EmitSound("purgestart.wav") Or play a sound everywhere (only works on client so place inside net.Receive purge_start): surface.PlaySound("purgestart.wav") Don't forget to precache the sound on both the client and server: util.PrecacheSound("purgestart.wav")
I followed a tutorial a friend made and now I have no idea why my entity isn't displaying the correct time. The base system is established in autorun files (client and server). But because those systems are in place I have no idea what the actual entity code should look like... please add me on Discord so I can send you the files (Practo-Proko#1767)
Sorry, you need to Log In to post a reply to this thread.