Why won't this work. (It won't format correctly for some reason so just use this link: [URL]http://puu.sh/4qt8r.txt[/URL])
[lua]
if SERVER thenfunction ColorToggle( ply ) umsg.Start( "ColorToggle", ply ) umsg.End()end hook.Add("ShowTeam", "ColorToggle", ColorToggle) endif CLIENT thenlocal color = true local function RenderColorModify() if (color == false) then local tab = {} tab[ "$pp_colour_addr" ] = 0 tab[ "$pp_colour_addg" ] = 0 tab[ "$pp_colour_addb" ] = 0 tab[ "$pp_colour_brightness" ] = 0 tab[ "$pp_colour_contrast" ] = 1 tab[ "$pp_colour_colour" ] = 0 tab[ "$pp_colour_mulr" ] = 0 tab[ "$pp_colour_mulg" ] = 0 tab[ "$pp_colour_mulb" ] = 0 DrawColorModify( tab ) else local tab = {} tab[ "$pp_colour_addr" ] = 0 tab[ "$pp_colour_addg" ] = 0 tab[ "$pp_colour_addb" ] = 0 tab[ "$pp_colour_brightness" ] = 0 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 ) endend local function ColorToggle() if (color == false) then color = true else color = false endend usermessage.Hook("ColorToggle", ColorToggle)hook.Add( "RenderScreenspaceEffects", "RenderColorModify", RenderColorModify )end[/lua]
why the fuck are you sending it from the server to the client rather then just running the code on the client?
You forgot to end this:
[code] if (color == false) then
local tab = {}
tab[ "$pp_colour_addr" ] = 0
tab[ "$pp_colour_addg" ] = 0
tab[ "$pp_colour_addb" ] = 0
tab[ "$pp_colour_brightness" ] = 0
tab[ "$pp_colour_contrast" ] = 1
tab[ "$pp_colour_colour" ] = 0
tab[ "$pp_colour_mulr" ] = 0
tab[ "$pp_colour_mulg" ] = 0
tab[ "$pp_colour_mulb" ] = 0
DrawColorModify( tab )
else
local tab = {}
tab[ "$pp_colour_addr" ] = 0
tab[ "$pp_colour_addg" ] = 0
tab[ "$pp_colour_addb" ] = 0
tab[ "$pp_colour_brightness" ] = 0
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 )
[/code]
Here is what the code should look like:
[code]if SERVER then
function ColorToggle( ply )
umsg.Start( "ColorToggle", ply )
umsg.End()
end
hook.Add("ShowTeam", "ColorToggle", ColorToggle)
end
if CLIENT then
local color = true
local function RenderColorModify()
if (color == false) then
local tab = {}
tab[ "$pp_colour_addr" ] = 0
tab[ "$pp_colour_addg" ] = 0
tab[ "$pp_colour_addb" ] = 0
tab[ "$pp_colour_brightness" ] = 0
tab[ "$pp_colour_contrast" ] = 1
tab[ "$pp_colour_colour" ] = 0
tab[ "$pp_colour_mulr" ] = 0
tab[ "$pp_colour_mulg" ] = 0
tab[ "$pp_colour_mulb" ] = 0
DrawColorModify( tab )
else
local tab = {}
tab[ "$pp_colour_addr" ] = 0
tab[ "$pp_colour_addg" ] = 0
tab[ "$pp_colour_addb" ] = 0
tab[ "$pp_colour_brightness" ] = 0
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
end
end
local function ColorToggle()
if (color == false) then
color = true
else
color = false
end
end
usermessage.Hook("ColorToggle", ColorToggle)
hook.Add( "RenderScreenspaceEffects", "RenderColorModify", RenderColorModify )
end[/code]
[QUOTE=Johnny Guitar;42182164]why the fuck are you sending it from the server to the client rather then just running the code on the client?[/QUOTE]
Rather than you question my use for this, I'd like an answer.
bump
Sorry, you need to Log In to post a reply to this thread.