Probelms with Clients and cl_int

Hey, I’m not new to lua, but I am extremely new to client side effects and what not. I’ve never messed with them before, and I keep having problems with my cl_init.

The script I’m working on is for my first Gamemode. When I get further along I’ll give more info…

The first problem was, It was working for me in my gamemode, but when friends joined, it didnt. No error, nothing. Just wouldnt work. Didnt say it failed to load, just did nothing.

I ended up fixing this, because I reliezed I had a wrongful include(“whatnot.lua”). After removing that, everything worked fine. But somehow, today while testing, it happend again. I changed alot of it since the last people (besides myself) tested it.

Please, please please! Take a look at my code, tell me if you see anything out of place, broken, or wrong.

thanks in advance! I’ll probably go to bed now (been trying to fix this damn thing all night!). If anyone anwsers I’ll reply tomorrow!

The whole cl_init file:

In the file, I’m attempting to make it so, the blind ones see pretty much normal (maybe darker) and the Seers see better in the dark and can see ppl through walls.

NOTE: my effects all work, this all works for me, but won’t show for clients joining my listen server. Theres also a older code in there, the KeyPress isnt really needed anymore, but removing it doesnt make a difference… so I kept it, might use it later.



include("shared.lua")
function GM:SpawnMenuOpen()
 return false 
end
function GM:ContextMenuOpen()
 return false 
end
 
function GM:PostProcessPermitted( name )
 return false
end
function GM:KeyPress(p, key) 
 if ( key == IN_SPEED ) then 
  if ( p:Team( )== TEAM_SEER ) then
 
 
local function PUMPPPTEST()
 
 local tab = {}
 tab[ "$pp_colour_addr" ] = 0
 tab[ "$pp_colour_addg" ] = .03
 tab[ "$pp_colour_addb" ] = 0
 tab[ "$pp_colour_brightness" ] = .002
 tab[ "$pp_colour_contrast" ] = 1.87
 tab[ "$pp_colour_colour" ] = 1
 tab[ "$pp_colour_mulr" ] = 0
 tab[ "$pp_colour_mulg" ] = 0
 tab[ "$pp_colour_mulb" ] = 0
  //DrawSharpen( 1, 1 )
//DrawMotionBlur( 0.1, 0.79, 0.05)
 DrawColorModify( tab )
end
hook.Add( "RenderScreenspaceEffects", "RenderColorModifyPOO", PUMPPPTEST )
  for k,v in pairs( ents.GetAll() ) do
 
  if string.sub( (v:GetModel() or "" ), -3) == "mdl" then 
 
 
   local r,g,b,a = v:GetColor()
   local entmat = v:GetMaterial()
   if v:IsNPC() or v:IsPlayer() then 
   v:SetMaterial( "vision" )
    end
   end
 
  end
 end
end
if ( p:Team( )== TEAM_BLIND ) then
return end
 self.BaseClass:KeyPress(p, key)
end
function GM:KeyRelease(p, key) 
 if ( key == IN_SPEED ) then 
  if ( p:Team( )== TEAM_XENO ) then
 
 
 local function PUMPPPTEST()
 
 local tab = {}
 tab[ "$pp_colour_addr" ] = 0
 tab[ "$pp_colour_addg" ] = .001
 tab[ "$pp_colour_addb" ] = 0
 tab[ "$pp_colour_brightness" ] = .002
 tab[ "$pp_colour_contrast" ] = 1
 tab[ "$pp_colour_colour" ] = 1
 tab[ "$pp_colour_mulr" ] = 0
 tab[ "$pp_colour_mulg" ] = 0
 tab[ "$pp_colour_mulb" ] = 0 
 
 DrawColorModify( tab )
end
hook.Add( "RenderScreenspaceEffects", "RenderColorModifyPOO", PUMPPPTEST )
for k,v in pairs( ents.GetAll() ) do
 
  if string.sub( (v:GetModel() or "" ), -3) == "mdl" then 
 
 
   local r,g,b,a = v:GetColor()
   local entmat = v:GetMaterial()
   if v:IsNPC() or v:IsPlayer() then 
   v:SetMaterial( "" )
    end
   end
 
  end
  end
  end
if ( p:Team( )== TEAM_BLIND ) then
 local function PUMPPPTEST()
 
 local tab = {}
 tab[ "$pp_colour_addr" ] = 0
 tab[ "$pp_colour_addg" ] = 0
 tab[ "$pp_colour_addb" ] = 0
 tab[ "$pp_colour_brightness" ] = -.003
 tab[ "$pp_colour_contrast" ] = 1
 tab[ "$pp_colour_colour" ] = 1
 tab[ "$pp_colour_mulr" ] = 0
 tab[ "$pp_colour_mulg" ] = 0
 tab[ "$pp_colour_mulb" ] = 0 
 
 DrawColorModify( tab )
end
hook.Add( "RenderScreenspaceEffects", "RenderColorModifyPOO", PUMPPPTEST )
for k,v in pairs( ents.GetAll() ) do
 
  if string.sub( (v:GetModel() or "" ), -3) == "mdl" then 
 
 
   local r,g,b,a = v:GetColor()
   local entmat = v:GetMaterial()
   if v:IsNPC() or v:IsPlayer() then 
   v:SetMaterial( "" )
    end
   end
 
  end
  end
 
 self.BaseClass:KeyPress(p, key)
end
 
function GM:PlayerBindPress( ply, bind, pressed )
 if not pressed then return false end
 
 
if string.find(bind, "toggle_zoom") then return true end
  if string.find( bind, "impulse 100" ) then return true end
 if string.find( bind, "flashlight" ) then return true end
end
function GM:RenderScreenspaceEffects()
 if ( LocalPlayer():Team( )== TEAM_BLIND ) then
 
 
 local tab = {}
 tab[ "$pp_colour_addr" ] = 0
 tab[ "$pp_colour_addg" ] = 0
 tab[ "$pp_colour_addb" ] = 0
 tab[ "$pp_colour_brightness" ] = -.003
 tab[ "$pp_colour_contrast" ] = 1
 tab[ "$pp_colour_colour" ] = 1
 tab[ "$pp_colour_mulr" ] = 0
 tab[ "$pp_colour_mulg" ] = 0
 tab[ "$pp_colour_mulb" ] = 0
 DrawSharpen( .3, .3 )
DrawColorModify( tab )
end
 
 hook.Add( "RenderScreenspaceEffects", "RenderColorModifyPOO", PUMPPPTEST )
 if ( LocalPlayer():Team( )== TEAM_SEER ) then
 
local function PUMPPPTEST()
 
 local tab = {}
 tab[ "$pp_colour_addr" ] = 0
 tab[ "$pp_colour_addg" ] = .03
 tab[ "$pp_colour_addb" ] = 0
 tab[ "$pp_colour_brightness" ] = .002
 tab[ "$pp_colour_contrast" ] = 1.87
 tab[ "$pp_colour_colour" ] = 1
 tab[ "$pp_colour_mulr" ] = 0
 tab[ "$pp_colour_mulg" ] = 0
 tab[ "$pp_colour_mulb" ] = 0
  //DrawSharpen( 1, 1 )
//DrawMotionBlur( 0.1, 0.79, 0.05)
 DrawColorModify( tab )
end
hook.Add( "RenderScreenspaceEffects", "RenderColorModifyPOO", PUMPPPTEST )
  for k,v in pairs( ents.GetAll() ) do
 
  if string.sub( (v:GetModel() or "" ), -3) == "mdl" then 
 
 
   local r,g,b,a = v:GetColor()
   local entmat = v:GetMaterial()
   if v:IsNPC() or v:IsPlayer() then 
   v:SetMaterial( "vision" )
    end
   end
 
  end
 end
end


Bump for a friend.

Since this is a clientside file I think you need to AddCSLuaFile(“shared.lua”) instead of include. Also, make sure your init.lua file is AddCSLuaFile’ing this file and not including it. Also, run this as a listen server and look in your console for any errors at all.

Thanks for replying, I’ll try the AddCSlua file in cl_init, and init was AddCSlua.

So far this problem has given, NO errors at all. its extremely frustrating.

UPDATE: just tried your suggestion, it broke it. The effects don’t show up for me either if I put in AddCSluaFile(“shared.lua”) to cl_init

Actually I think cl_init will use include, since cl_init already is client side to begin with.

Alright, seems to be working now! I removed the include(“cl_init”) from the init.lua and that has seemed to fix it!

Thanks for all your help!

No problem :slight_smile: