• Serverside jetpack being affected by ping? (Checked for by a timer)
    1 replies, posted
  • Avatar of flyguy88
  • The jetpack seems to be less effective as your ping goes up, i tested it with other players and myself using net_fakelag 200. My boost wouldn't be nearly as powerful if i had net_fakelag on and my bots would stay the same. I have a jetpack function in shared.lua - [code] local meta = FindMetaTable("Player") if (!meta) then return end function meta:JetPack() --Vector(0,0,self:GetVelocity()[3]) <cool local boostmagnitude = 10 if (self.boost > 0) then --self.boost = self.boost - global_boostreductionrate self:SetGroundEntity(NULL) --self:SetGroundEntity(NULL) self:SetVelocity(self:GetUp() * boostmagnitude) local effectdata = EffectData() effectdata:SetOrigin(self:GetPos()) util.Effect( "pixiehit", effectdata) end end [/code] I am running it here, in init.lua - [code] function Handlejetpack() for k,v in pairs(player.GetAll()) do if v.jetpack == true then v:JetPack() else v:JetPackRegen() end end end --hook.Add("Think", "handlingjets", Handlejetpack) timer.Create( "JetPackCheckTimer", 0.01, 0, Handlejetpack) [/code] The jetpack is toggled here - [code] function Toggleonjet(pl, key) if key == IN_ATTACK2 then pl.jetpack = true end end hook.Add("KeyPress", "tooto", Toggleonjet) function Toggleoffjet(pl, key) if key == IN_ATTACK2 then pl.jetpack = false end end hook.Add("KeyRelease", "foekfosokf", Toggleoffjet) [/code] I'd be grateful if anyone could shed any light on the problem. Here is a video example, I have net_fakelag on 200 here and a bot(the bot has no ping of course). [URL]http://farmpolice.com/content/videos/k6O3BXQYELsIgmGr.webm[/URL] [vid]http://farmpolice.com/content/videos/k6O3BXQYELsIgmGr.webm[/vid]
  • Avatar of flyguy88
  • Fixed I'm not sure why this was happening but here is what i did. new jetpack function, essentially the same. [code] function meta:JetPackOn() local boostmagnitude = 50 if (self.boost > 0) then self:SetGroundEntity(NULL) self:SetVelocity(self:GetUp() * boostmagnitude) local effectdata = EffectData() effectdata:SetOrigin(self:GetPos()) util.Effect( "pixiehit", effectdata) end end [/code] [code] function Toggleonjet(pl, key) if key == IN_ATTACK2 then pl.jetpack = true --timer.Start(pl:GetName()) timer.Create(pl:GetName(), 0.1, 0, function () pl:JetPackOn() end) end end hook.Add("KeyPress", "tooto", Toggleonjet) [/code] Toggling timers for each individual worked perfectly compared to the other method. [code] function Toggleoffjet(pl, key) if key == IN_ATTACK2 then pl.jetpack = false --timer.Stop(pl:GetName()) timer.Destroy(pl:GetName()) end end hook.Add("KeyRelease", "foekfosokf", Toggleoffjet) [/code]