Can't find why it says this, just loaded the mod please help
[ERROR] addons/durgzmod/lua/entities/durgz_mushroom/shared.lua:89: bad argument #2 to 'Exists' (string expected, got no value)
1. Exists - [C]:-1
2. fn - addons/durgzmod/lua/entities/durgz_mushroom/shared.lua:89
3. unknown - addons/ulib/lua/ulib/shared/hook.lua:110
-----------------------------------Shared Lua File--------------------------------------------
ENT.Type = "anim"
ENT.Base = "durgz_base"
ENT.PrintName = "Mushrooms"
ENT.Nicknames = {"shrooms", "magic mushrooms", "mushrooms"}
ENT.OverdosePhrase = {"ate too many", "consumed a lot of"}
ENT.Author = "cheesylard (inspired by ninjers)"
ENT.Spawnable = true
ENT.AdminSpawnable = true
ENT.Information = "*Insert mario reference here*"
ENT.TRANSITION_TIME = 6
--function for high visuals
if(CLIENT)then
local MOVE_FACE_DOWN = 0;
local MOVE_FACE_UP = 1;
local MOVE_FACE_LEFT = 2;
local MOVE_FACE_RIGHT = 3;
local TRANSITION_TIME = ENT.TRANSITION_TIME; --transition effect from sober to high, high to sober, in seconds how long it will take etc.
local HIGH_INTENSITY = 0.77; --1 is max, 0 is nothing at all
local TIME_TO_GO_ACROSS_SCREEN = 3;
local whichWay = 2;
local startawesomefacemove = 0;
local function DoMushrooms()
--self:SetNetworkedFloat( "SprintSpeed"
local pl = LocalPlayer();
local shroom_tab = {}
shroom_tab[ "$pp_colour_addr" ] = 0
shroom_tab[ "$pp_colour_addg" ] = 0
shroom_tab[ "$pp_colour_addb" ] = 0
//shroom_tab[ "$pp_colour_brightness" ] = 0
//shroom_tab[ "$pp_colour_contrast" ] = 1
shroom_tab[ "$pp_colour_mulr" ] = 0
shroom_tab[ "$pp_colour_mulg" ] = 0
shroom_tab[ "$pp_colour_mulb" ] = 0
if( pl:GetNetworkedFloat("durgz_mushroom_high_start") && pl:GetNetworkedFloat("durgz_mushroom_high_end") > CurTime() )then
if( pl:GetNetworkedFloat("durgz_mushroom_high_start") + TRANSITION_TIME > CurTime() )then
local s = pl:GetNetworkedFloat("durgz_mushroom_high_start");
local e = s + TRANSITION_TIME;
local c = CurTime();
local pf = (c-s) / (e-s);
shroom_tab[ "$pp_colour_colour" ] = 1 - pf*0.37
shroom_tab[ "$pp_colour_brightness" ] = -pf*0.15
shroom_tab[ "$pp_colour_contrast" ] = 1 + pf*1.57
//DrawMotionBlur( 1 - 0.18*pf, 1, 0);
DrawColorModify( shroom_tab )
DrawSharpen( 8.32,1.03*pf )
elseif( pl:GetNetworkedFloat("durgz_mushroom_high_end") - TRANSITION_TIME < CurTime() )then
local e = pl:GetNetworkedFloat("durgz_mushroom_high_end");
local s = e - TRANSITION_TIME;
local c = CurTime();
local pf = 1 - (c-s) / (e-s);
shroom_tab[ "$pp_colour_colour" ] = 1 - pf*0.37
shroom_tab[ "$pp_colour_brightness" ] = -pf*0.15
shroom_tab[ "$pp_colour_contrast" ] = 1 + pf*1.57
//DrawMotionBlur( 1 - 0.18*pf, 1, 0);
DrawColorModify( shroom_tab )
DrawSharpen( 8.32,1.03*pf )
else
shroom_tab[ "$pp_colour_colour" ] = 0.63
shroom_tab[ "$pp_colour_brightness" ] = -0.15
shroom_tab[ "$pp_colour_contrast" ] = 2.57
//DrawMotionBlur( 0.82, 1, 0);
DrawColorModify( shroom_tab )
DrawSharpen( 8.32,1.03 )
end
end
end
local function DoMushroomsFace()
local pl = LocalPlayer();
if( file.Exists("../materials/VGUI/durgzmod/awesomeface.vmt") && pl:GetNetworkedFloat("durgz_mushroom_high_start") && pl:GetNetworkedFloat("durgz_mushroom_high_end") > CurTime() )then
local pf = 1;
if( pl:GetNetworkedFloat("durgz_mushroom_high_start") + TRANSITION_TIME > CurTime() )then
local s = pl:GetNetworkedFloat("durgz_mushroom_high_start");
local e = s + TRANSITION_TIME;
local c = CurTime();
pf = (c-s) / (e-s);
elseif( pl:GetNetworkedFloat("durgz_mushroom_high_end") - TRANSITION_TIME < CurTime() )then
local e = pl:GetNetworkedFloat("durgz_mushroom_high_end");
local s = e - TRANSITION_TIME;
local c = CurTime();
pf = 1 - (c-s) / (e-s);
end
surface.SetTexture(surface.GetTextureID("VGUI/durgzmod/awesomeface"))
surface.SetDrawColor(255, 255, 255, pf*180)
surface.DrawTexturedRect(x, y, ScrH, ScrH) --gets your screen resolution
end
end
hook.Add("RenderScreenspaceEffects", "durgz_mushroom_high", DoMushrooms)
hook.Add("HUDPaint", "durgz_mushroom_awesomeface", DoMushroomsFace)
end
/*
Motion Blur
add: 0.82 (default 1)
draw: 1
delay: 0
Color Mod
bright: -0.21
contrast: 2.57
color mul: 0.37
Sharpen
distance: 1.03 (default 0)
contrast: 8.32
*/
Please at least wrap your text with [code.][/code.] tags
without the periods
It looks like you're using a version from GMod 12. file.Exists takes two args now: [url]https://wiki.garrysmod.com/page/file/Exists[/url]
[editline]27th July 2016[/editline]
[QUOTE=Thane;50781874]Please at least wrap your text with [code.][/code.] tags
without the periods[/QUOTE]
You can use noparse to display tags. [noparse][code][/code][/noparse]
How do I fix it? I'm at the wiki
Add a second arg to file.Exists. Your options are on the wiki.
Now for the third error in the hooked.lua:110
It's bolded
local gmod = gmod
local pairs = pairs
local isfunction = isfunction
local isstring = isstring
local isnumber = isnumber
local math = math
local IsValid = IsValid
--[[
local concommand = concommand
local print = print
local PrintTable = PrintTable
local tostring = tostring
local assert = assert
local table = table--]]
HOOK_MONITOR_HIGH = -2
HOOK_HIGH = -1
HOOK_NORMAL = 0
HOOK_LOW = 1
HOOK_MONITOR_LOW = 2
if hook.GetULibTable then return end -- Prevent autorefresh reloading this file
-- Grab all previous hooks from the pre-existing hook module.
local OldHooks = hook.GetTable()
module( "hook" )
local Hooks = {}
local BackwardsHooks = {} -- A table fully to garry's spec for aVoN
--
-- For access to the Hooks table.. for some reason.
--
function GetTable() return BackwardsHooks end
function GetULibTable() return Hooks end
--
-- Add a hook
--
function Add( event_name, name, func, priority )
priority = priority or 0
if ( !isfunction( func ) ) then return end
if ( !isstring( event_name ) ) then return end
if ( !isnumber( priority ) ) then return end
priority = math.floor( priority )
if ( priority < -2 ) then priority = -2 end -- math.Clamp may not have been defined yet
if ( priority > 2 ) then priority = 2 end
Remove( event_name, name ) -- This keeps the event name unique, even among the priorities
if (Hooks[ event_name ] == nil) then
Hooks[ event_name ] = {[-2]={}, [-1]={}, [0]={}, [1]={}, [2]={}}
BackwardsHooks[ event_name ] = {}
end
Hooks[ event_name ][ priority ][ name ] = { fn=func, isstring=isstring( name ) }
BackwardsHooks[ event_name ][ name ] = func -- Keep the classic style too so we won't break anything
end
--
-- Remove a hook
--
function Remove( event_name, name )
if ( !isstring( event_name ) ) then return end
if ( !Hooks[ event_name ] ) then return end
for i=-2, 2 do
Hooks[ event_name ][ i ][ name ] = nil
end
BackwardsHooks[ event_name ][ name ] = nil
end
--
-- Run a hook (this replaces Call)
--
function Run( name, ... )
return Call( name, gmod and gmod.GetGamemode() or nil, ... )
end
--
-- Called by the engine
--
function Call( name, gm, ... )
--
-- Run hooks
--
local HookTable = Hooks[ name ]
if ( HookTable != nil ) then
for i=-2, 2 do
for k, v in pairs( HookTable[ i ] ) do
if ( v.isstring ) then
--
-- If it's a string, it's cool
--
[B]local a, b, c, d, e, f = v.fn( ... )[/B]
if ( a != nil && i > -2 && i < 2 ) then
return a, b, c, d, e, f
end
else
--
-- If the key isn't a string - we assume it to be an entity
-- Or panel, or something else that IsValid works on.
--
if ( IsValid( k ) ) then
--
-- If the object is valid - pass it as the first argument (self)
--
local a, b, c, d, e, f = v.fn( k, ... )
if ( a != nil && i > -2 && i < 2 ) then
return a, b, c, d, e, f
end
else
--
-- If the object has become invalid - remove it
--
HookTable[ i ][ k ] = nil
end
end
end
end
end
--
-- Call the gamemode function
--
if ( !gm ) then return end
local GamemodeFunction = gm[ name ]
if ( GamemodeFunction == nil ) then return end
return GamemodeFunction( gm, ... )
end
-- Bring in all the old hooks
for event_name, t in pairs( OldHooks ) do
for name, func in pairs( t ) do
Add( event_name, name, func )
end
end
--[[
local failed = false
local shouldFail = false
local i, t
-- Since the correctness of this file is so important, we've made a little test suite
local function appendGenerator( n )
return function( t )
table.insert( t, n )
end
end
local function returnRange()
return 1, 2, 3, 4, 5, 6, 7, 8
end
local function noop()
end
local function err()
if shouldFail then
error( "this error is normal!" )
else
error( "this error is bad!" )
failed = true
end
end
local function doTests( ply, cmd, argv )
print( "Being run on client: " .. tostring( CLIENT ) )
-- First make sure there's no return value leakage...
Add( "LeakageA", "a", returnRange )
t = { Call( "LeakageA", _ ) }
assert( #t == 6 )
for k, v in pairs( t ) do
assert( k == v )
end
Add( "LeakageB", "a", noop )
t = { Call( "LeakageB", _ ) }
assert( #t == 0 )
-- Now let's make sure errors are handled correctly...
shouldFail = true
Add( "ErrCheck", "a", noop )
--Add( "ErrCheck", "b", err )
Add( "ErrCheck", "c", noop )
Add( "ErrCheck", "d", returnRange )
t = { Call( "ErrCheck", _ ) }
assert( #t == 6 )
--assert( #Hooks.ErrCheck == 3 and Hooks.ErrCheck[4] == nil ) -- Should have been reduced so that the 'b' got removed
shouldFail = false
t = { Call( "ErrCheck", _ ) }
assert( #t == 6 )
-- Check for override
Add( "ErrCheck", "d", noop, 1 ) -- Different priority, same name should still override
t = { Call( "ErrCheck", _ ) }
assert( #t == 0 )
-- Check for order and readonly'ness...
Add( "Order", "n20a", returnRange, -2 )
Add( "Order", "a", appendGenerator( 3 ) )
Add( "Order", "n20a", appendGenerator( 1 ), -2 )
Add( "Order", "n10a", appendGenerator( 2 ), -1 )
Add( "Order", "10a", appendGenerator( 4 ), 1 )
Add( "Order", "20a", returnRange, 2 )
Add( "Order", "20aa", appendGenerator( 5 ), 2 )
t = {}
Call( "Order", _, t )
print( t, #t )
PrintTable( t )
assert( #t == 5 )
for k, v in pairs( t ) do
assert( k == v )
end
Add( "Test", "AAA", function () print( "AAA" ) Remove( "Test", "AAA" ) end )
Add( "Test", "BBB", function () print( "BBB" ) end)
Run( "Test" )
Run( "Test" )
if failed then
print( "Tests failed!" )
else
print( "All tests passed!" )
end
end
concommand.Add( "run_hook_tests", doTests )--]]
[editline]27th July 2016[/editline]
[QUOTE=code_gs;50783571]Add a second arg to file.Exists. Your options are on the wiki.[/QUOTE]
Alright I added ,"LUA" to the line and that worked ty
[editline]27th July 2016[/editline]
I did it, ty for your help
And you still don't wrap your code with the code tags...
Sorry, you need to Log In to post a reply to this thread.