Advertisement
quintosh

falco xray

Jan 7th, 2012
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.11 KB | None | 0 0
  1. local RayOn = false
  2. local AllMats = {}
  3. local allcolors = {}
  4. local FSetColor = _R.Entity.SetColor
  5. local FSetMat = _R.Entity.SetMaterial
  6. local FGetMat = _R.Entity.GetMaterial
  7. local repmat = CreateClientConVar("falco_xraymaterial", "mat2", true, false)
  8.  
  9. local function TogglePoKiRay()
  10.     if RayOn then
  11.         surface.PlaySound("buttons/button9.wav")
  12.         for k,v in pairs(ents.GetAll()) do
  13.             FSetMat(v, AllMats[v])
  14.             local z = allcolors[v]
  15.             if z and type(z) == "table" then
  16.                 FSetColor(v, z.r, z.g, z.b, z.a)
  17.             else
  18.                 FSetColor(v, 255,255,255,255)
  19.             end
  20.         end
  21.         allcolors = {}
  22.     else
  23.         for k,v in pairs(ents.GetAll()) do
  24.             ExecFRayOnce(v)
  25.         end
  26.         surface.PlaySound("buttons/button9.wav")
  27.     end
  28.     RayOn = not RayOn
  29. end
  30. concommand.Add("quinray", TogglePoKiRay)
  31.  
  32. function ExecFRayOnce(v)
  33.     local r,g,b,a = v:GetColor()
  34.     local class = v:GetClass()
  35.     local low = string.lower(class)
  36.     if v:IsNPC() and (r ~= 0 or g ~= 0 or b ~= 255 or a ~= 255) then
  37.         allcolors[v] = Color(r,g,b,a)
  38.         FSetColor(v, 0, 0, 255, 255)
  39.     elseif v:IsWeapon() and (r ~= 140 or g ~= 0 or b ~= 255 or a ~= 255) then
  40.         allcolors[v] = Color(r,g,b,a)
  41.         FSetColor(v, 140, 0, 255, 255)
  42.     elseif string.find(class, "ghost") and a ~= 100 then
  43.         allcolors[v] = Color(r,g,b,a)
  44.         FSetColor(v, 255,255,255,100)
  45.     elseif (class == "drug_lab" or class == "money_printer") and (r ~= 255 or g ~= 0 or b ~= 100 or a ~= 50) then
  46.         allcolors[v] = Color(r,g,b,a)
  47.         FSetColor(v, 255, 0, 100, 50)
  48.     elseif v:GetClass() == "viewmodel" and (r ~= 0 or g ~= 0 or b ~= 0 or a ~= 30)  then
  49.         allcolors[v] = Color(r,g,b,a)
  50.         FSetColor(v, 0, 0, 210, 40)
  51.     elseif not v:IsPlayer() and not v:IsNPC() and class ~= "prop_physics" and class ~= "prop" and class ~= "drug_lab" and class ~= "money_printer" and not v:IsWeapon() and class ~= "viewmodel" and not string.find(class, "ghost") and ( r ~= 255 or g ~= 200 or b ~= 0 or a ~= 100) then
  52.         allcolors[v] = Color(r,g,b,a)
  53.         FSetColor(v, 250, 0, 250, 100)
  54.     end
  55.     if class ~= "viewmodel" and FGetMat(v) ~= repmat:GetString() and class ~= "func_door" and class ~= "func_door_rotating" and class ~= "prop_door_rotating" and not string.find(class, "ghost") then
  56.         AllMats[v] = FGetMat(v)
  57.         FSetMat(v, repmat:GetString())
  58.     end
  59. end
  60.  
  61. function DoPoKiRay()
  62.     if not RayOn then return end
  63.     for k,v in pairs(ents.FindByClass("prop_physics")) do
  64.         if ValidEntity(v) then
  65.             FSetColor(v,255, 255, 20, 40)
  66.             FSetMat(v, repmat:GetString())
  67.         end
  68.     end
  69.    
  70.     for k,v in pairs(ents.FindByClass("prop")) do
  71.         if ValidEntity(v) then
  72.             FSetColor(v,255, 255, 50, 40)
  73.             FSetMat(v, repmat:GetString())
  74.         end
  75.     end
  76.    
  77.     for k,v in pairs(player.GetAll()) do
  78.         if ValidEntity(v) then
  79.             FSetColor(v,250,50,250,255)
  80.             FSetMat(v, repmat:GetString())
  81.         end
  82.     end
  83. end
  84. hook.Add( "RenderScene", "PoKiRay", DoPoKiRay)
  85.  
  86. local ColorMod ={}
  87. ColorMod[ "$pp_colour_addr" ] = 0
  88. ColorMod[ "$pp_colour_addg" ] = 0
  89. ColorMod[ "$pp_colour_addb" ] = 0
  90. ColorMod[ "$pp_colour_brightness" ] = -0.1
  91. ColorMod[ "$pp_colour_contrast" ] = 1
  92. ColorMod[ "$pp_colour_colour" ] = 1
  93. ColorMod[ "$pp_colour_mulr" ] = 0
  94. ColorMod[ "$pp_colour_mulg" ] = 0
  95. ColorMod[ "$pp_colour_mulb" ] = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement