Player - Weapon colorizer

http://cloud-4.steampowered.com/ugc/432658080877536052/2C8D955915CD363CC41CE2DEF90B88F20E8DB1D9/

(Sorry for 1 minute avatar)

Just made a simple script that let you to change your weapon colors like a rainbow…

Workshop addon:

Video:

SourceCode: (I’ll post it here because are just 53 lines)

[lua]

if !ConVarExists(“gzg_onlyGroup”) then
CreateConVar(“gzg_onlyGroup”,0)
end

if !ConVarExists(“gzg_ocilation”) then
CreateConVar(“gzg_ocilation”,25)
end

if !ConVarExists(“gzg_doplayer”) then
CreateConVar(“gzg_doplayer”,1)
end

if !ConVarExists(“gzg_usergroup”) then
CreateConVar(“gzg_usergroup”,“superadmin admin donators vip”)
end

if SERVER then return end

local function canFlash(ply)

if(GetConVarNumber("gzg_onlyGroup") == 0) then return true end

local str = GetConVarString("gzg_usergroup")
local gr = string.Explode(" ",str)

return(table.HasValue(gr,ply:GetNWString("usergroup")))

end

hook.Add(“PostDrawViewModel”,“RainbowPhysgun”,function(v,p,w)

if(canFlash(p)) then
	p:SetWeaponColor(Vector(math.abs(math.cos(RealTime  ()*GetConVarNumber("gzg_ocilation")/10)),math.abs(math.sin(RealTime()*GetConVarNumber("gzg_ocilation")/10)),math.sin(RealTime()*GetConVarNumber("gzg_ocilation")/10)))
end

end)

hook.Add(“PostPlayerDraw”, “RainbowPhysgunOthers”, function()

for k,v in pairs(player.GetAll()) do
	
	if(IsValid(v:GetActiveWeapon()) && v:GetActiveWeapon():GetClass() == "weapon_physgun" && canFlash(v)) then
		v:SetWeaponColor(Vector(math.abs(math.cos(RealTime  ()*GetConVarNumber("gzg_ocilation")/10)),math.abs(math.sin(RealTime()*GetConVarNumber("gzg_ocilation")/10)),math.sin(RealTime()*GetConVarNumber("gzg_ocilation")/10)))
	end

	if(GetConVarNumber("gzg_doplayer") == 1 && canFlash(v)) then
		v:SetPlayerColor(Vector(math.abs(math.cos(RealTime  ()*GetConVarNumber("gzg_ocilation")/10)),math.abs(math.sin(RealTime()*GetConVarNumber("gzg_ocilation")/10)),math.sin(RealTime()*GetConVarNumber("gzg_ocilation")/10)))
	end

end

end)
[/lua]

That’s a pretty funny addon.

:slight_smile:

wow put a seizure warning on this shit

I did this is 1 minutes with a simple .lua that works using the persons steam ID. So I can make donators have it.

But umm. Good job?

Even though mine is only 14 lines of code (;

WOAH! Master race…

[lua]
hook.Add(“PostDrawViewModel”,“RainbowPhysgun”,function(v,p,w)
if(p:IsUserGroup(“donator”)) then
p:SetWeaponColor(Vector(math.abs(math.cos(RealTime ()*0.4)),math.abs(math.sin(RealTime()*0.4)),math.sin(RealTime()*0.4)))
end
end)
hook.Add(“PostPlayerDraw”, “RainbowPhysgunOthers”, function()
for k,v in pairs(player.GetAll()) do
if(p:IsUserGroup(“donator”)) then
v:SetWeaponColor(Vector(math.abs(math.cos(RealTime ()*0.4)),math.abs(math.sin(RealTime()*0.4)),math.sin(RealTime()*0.4)))
end
end
end)[/lua]

12 lines
Using steamid for check if these are donators? No…