Not read files

Hello everyone i have a problem with a custom file with my test.

i create a folder called (“testeo”) inside (“lua”) inside (“autorun”) inside (“sh_test.lua”)

inside of (“testeo”) other folder called (“test_addon”) inside (“sv_test.lua”) and (“sh_test_config.lua”)

sh_test.lua


if SERVER then
	include("test_addon/sh_test_config.lua")
	AddCSLuaFile("test_addon/sh_test_config.lua")

	include("test_addon/sv_test.lua")
end

sh_test_config.lua


pruebita = "INICIO"

tableteam = {TEAM_CITIZEN,TEAM_HARRY}

tabletest = {"pelo", "pico", "pata"}

comandtest = "/testeos"

sv_test.lua


hook.Add("PlayerSay", "Hitext",function(ply,text)
if ( text == comandtest ) then

	print(pruebita)

	if table.HasValue(tableteam,ply:Team()) then
		print("correct")
	else
		print("error")
	end

end

end)

Now i am (TEAM_CITIZEN) i write the command /testeos and don’t work any

if i join on (sublime text 3) file sh_test_config.lua and i save the file then now work the code

i don’t understand :frowning:

[editline]15th September 2017[/editline]

I Need save (the two files) sh_test_config.lua and sv_test.lua

The team enums probably aren’t initialized by then. Try declaring the table in a timer.

okey i put a timer


hook.Add("PlayerSay", "Hitext",function(ply,text)
if ( text == comandtest ) then

	print(pruebita)

	timer.Simple(1,function()
	if table.HasValue(tableteam,ply:Team()) then
		print("correct")
	else
		print("error")
	end
	end)

end

end)

but say me a print with error (im TEAM_CITIZEN) the sh_test_config.lua don’t read :frowning:

Not that section, the team table declaration in your config.

yes!! work!!

[editline]15th September 2017[/editline]

Many thanks code one more time :slight_smile: