Fix noxapi thinking all are supporters.

Changed zombiegasses effects.
This commit is contained in:
JetBoom 2014-12-23 11:26:08 -05:00
parent 8dffa52522
commit 714f3e88a6
2 changed files with 54 additions and 47 deletions

View file

@ -19,31 +19,41 @@ function ENT:Think()
end
end
local particleTable = {
[ 1 ] = { particle = "particle/smokesprites_0001", sizeStart = 0, sizeEnd = 96, airRecis = 90, startAlpha = 180, endAlpha = 0, randXY = 46, randZMin = 34, randZMax = 72, color = Color( 0, 80, 0 ), rotRate = 0.9, lifeTimeMin = 1.8, lifeTimeMax = 2.9 },
[ 2 ] = { particle = "particle/smokesprites_0002", sizeStart = 0, sizeEnd = 90, airRecis = 76, startAlpha = 110, endAlpha = 0, randXY = 24, randZMin = 24, randZMax = 62, color = Color( 0, 120, 0 ), rotRate = 0.6, lifeTimeMin = 1.6, lifeTimeMax = 2.2 },
[ 3 ] = { particle = "particle/smokesprites_0003", sizeStart = 0, sizeEnd = 140, airRecis = 49, startAlpha = 130, endAlpha = 0,randXY = 36, randZMin = 39, randZMax = 42, color = Color( 0, 90, 0 ), rotRate = 0.6, lifeTimeMin = 1.8, lifeTimeMax = 2.4 },
[ 4 ] = { particle = "particle/smokesprites_0004", sizeStart = 0, sizeEnd = 100, airRecis = 59, startAlpha = 160, endAlpha = 0,randXY = 42, randZMin = 31, randZMax = 68, color = Color( 0, 60, 0 ), rotRate = 0.2, lifeTimeMin = 1.6, lifeTimeMax = 2.9 },
[ 5 ] = { particle = "particle/smokesprites_0007", sizeStart = 0, sizeEnd = 160, airRecis = 79, startAlpha = 180, endAlpha = 0,randXY = 46, randZMin = 16, randZMax = 56, color = Color( 0, 70, 0 ), rotRate = 1.4, lifeTimeMin = 1.6, lifeTimeMax = 2.2 },
[ 6 ] = { particle = "particle/smokesprites_0008", sizeStart = 0, sizeEnd = 60, airRecis = 46, startAlpha = 190, endAlpha = 0,randXY = 49, randZMin = 12, randZMax = 48, color = Color( 0, 90, 0 ), rotRate = 1, lifeTimeMin = 1.7, lifeTimeMax = 2.4 },
[ 7 ] = { particle = "particle/particle_glow_03", sizeStart = 0, sizeEnd = 4, airRecis = 4, startAlpha = 255, endAlpha = 0,randXY = 69, randZMin = 16, randZMax = 64, color = Color( 0, 255, 0 ), rotRate = 0, lifeTimeMin = 1.5, lifeTimeMax = 2.8 },
}
function ENT:Draw()
if GAMEMODE.ZombieEscape or CurTime() < self.NextGas then return end
self.NextGas = CurTime() + math.Rand(0.08, 0.2)
self.NextGas = CurTime() + math.Rand( 0.05, 0.25 )
local radius = self:GetRadius()
local pos = self:GetPos()
local vecRan = VectorRand()
vecRan:Normalize()
local particledata = particleTable[math.random(7)]
vecRan = vecRan * math.Rand( 20, 40 )
vecRan.z = math.Rand( 10, 60 )
local randdir = VectorRand()
randdir.z = math.abs(randdir.z)
randdir:Normalize()
local emitpos = self:GetPos() + randdir * math.Rand(0, radius / 2)
local emitter = ParticleEmitter( pos )
emitter:SetNearClip( 48, 64 )
local emitter = ParticleEmitter(emitpos)
emitter:SetNearClip(48, 64)
local particle = emitter:Add("particles/smokey", emitpos)
particle:SetVelocity(randdir * math.Rand(8, 256))
particle:SetAirResistance(64)
particle:SetDieTime(math.Rand(1.2, 2.5))
particle:SetStartAlpha(math.Rand(70, 90))
particle:SetEndAlpha(0)
particle:SetStartSize(1)
particle:SetEndSize(radius * math.Rand(0.25, 0.45))
particle:SetRoll(math.Rand(0, 360))
particle:SetRollDelta(math.Rand(-1, 1))
particle:SetColor(0, math.Rand(40, 70), 0)
local particle = emitter:Add( particledata.particle, pos + vecRan )
particle:SetVelocity( Vector( math.Rand( -particledata.randXY, particledata.randXY ), math.Rand( -particledata.randXY, particledata.randXY ), math.Rand( particledata.randZMin, particledata.randZMax ) ) )
particle:SetColor( particledata.color.r, particledata.color.g, particledata.color.b )
particle:SetAirResistance( particledata.airRecis )
particle:SetCollide( true )
particle:SetDieTime( math.Rand( particledata.lifeTimeMin , particledata.lifeTimeMax ) )
particle:SetStartAlpha( particledata.startAlpha )
particle:SetEndAlpha( particledata.endAlpha )
particle:SetStartSize( particledata.sizeStart )
particle:SetEndSize( particledata.sizeEnd )
particle:SetRollDelta( math.Rand( -particledata.rotRate, particledata.rotRate ) )
emitter:Finish()
end

View file

@ -47,8 +47,8 @@ end
function CACHE:Save()
local tosave = {}
for steamid, level in pairs(self.Cache) do
table.insert(tosave, steamid.."="..level)
for _, cached in pairs(self.Cache) do
table.insert(tosave, cached[1].."="..cached[2])
end
file.Write("noxapi_cache.txt", table.concat(tosave, "\n"))
@ -69,23 +69,30 @@ end
function CACHE:BufferRequest()
local IDS = {}
local steamid_to_player = {}
local steamids = {}
for i=1, math.min(10, #Buffer) do
IDS[#IDS + 1] = {Buffer[1][1], Buffer[1][2]}
steamids[#steamids + 1] = Buffer[1][1]
table.remove(Buffer, 1)
end
local SIDS = {}
for k, v in pairs(IDS) do
SIDS[k] = v[1]
for _, pl in pairs(player.GetAll()) do
steamid_to_player[pl:SteamID()] = pl
end
http.Fetch("http://www.noxiousnet.com/api/player/memberlevel?steamids="..table.concat(SIDS, ","), function(body, len, headers, code)
http.Fetch("http://www.noxiousnet.com/api/player/memberlevel?steamids="..table.concat(steamids, ","), function(body, len, headers, code)
local levels = string.Explode(",", body)
if #levels == #SIDS then
for k, v in pairs(levels) do
local steamid = IDS[k][1]
if #levels == #IDS then
local allplayers = player.GetAll()
local pl = IDS[k][2]
if pl and pl:IsValid() then
for k, v in pairs(levels) do
local kv = string.Explode("=", v)
if #kv == 2 then
local steamid = kv[1]
local level = tonumber(kv[2]) or 0
local pl = steamid_to_player[steamid]
if (level == 1 or level == 2) and pl and pl:IsValid() then
pl:SetDTBool(15, true)
pl:PrintMessage(HUD_PRINTTALK, SUPPORTER_MESSAGE)
end
@ -93,6 +100,7 @@ function CACHE:BufferRequest()
CACHE:Set(steamid, level)
end
end
end
end)
if #Buffer > 0 then
@ -112,22 +120,11 @@ hook.Add("PlayerInitialSpawn", "noxapi", function(pl)
local steamid = pl:SteamID()
local memberlevel = CACHE:Get(steamid)
if memberlevel then
if level == 1 or level == 2 then
if memberlevel == 1 or memberlevel == 2 then
pl:SetDTBool(15, true)
pl:PrintMessage(HUD_PRINTTALK, SUPPORTER_MESSAGE)
end
else
http.Fetch("http://www.noxiousnet.com/api/player/memberlevel?steamid="..steamid, function(body, len, headers, code)
local level = tonumber(body) or 0
if level == 1 or level == 2 then
pl:SetDTBool(15, true)
pl:PrintMessage(HUD_PRINTTALK, SUPPORTER_MESSAGE)
end
CACHE:Set(steamid, level)
end)
table.insert(Buffer, {steamid, pl})
CACHE:WaitForBuffer()
end