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