expected table got string

Hey Guys,

Well i dont understand this why he needs a got damn table.



function HUDHide( myhud )
	for k, v in pairs("CHudHealth","CHudBattery") do
		if myhud == v then return false end
	end
end


In my old Code it works but now i made a new script and its start to spam my console with “bad argument #1 expteced table got string”

[lua]for k, v in pairs( { “CHUDHealth”, “CHudBattery” } ) do[/lua]

Table: {“CHudHealth”, “CHudBattery”}
Not table: “CHudHealth”, “CHudBattery”

[editline].[/editline]
too slow.

Thans…
But why it works in my old script .o.

What you posted would never work; you either overlooked the curly brackets or the code was never ran and couldn’t error.

Well one Question at least.
Always and every f*king time it says it can’t include shared.lua




// cl_init.lua
include( 'shared.lua' )

function HUDHide( myhud )
	for k, v in pairs( {"CHudHealth","CHudBattery"} ) do
		if myhud == v then return false end
	end
end
hook.Add("HUDShouldDraw","HUDHide",HUDHide)

// Error
Couldn't include file 'shared.lua' (File not found) (@gamemodes/copsnrob/gamemode/cl_init.lua (line 1))
E



And why comes this error?

I derived the sandbox gamemode in shared.lua

do you have a shared.lua file in the same folder as your cl_init.lua? It says that you don’t, or it could be empty.

Here:
http://i.epvpimg.com/hxH1g.png

Is it empty…?


GM.Name = "Cops 'n Robbers "
GM.Author = "HellYeah"
GM.Email = "hellyeah@outlook.de"
GM.Website = "thesurvivors.eu"

DeriveGamemode( "sandbox" )

function GM:Initialize( self )
	self.BaseClass.Initialize( self )
end


team.SetUp( 1, "Waiting", Color(244, 150, 5))
team.SetUp( 2, "Civilian", Color(212, 3, 18))
team.SetUp( 3, "Cop", Color(162, 18, 9))
team.SetUp( 4, "Wanted", Color(233, 0, 0))

util.PrecacheModel("models/player/artic.mdl")
util.PrecacheModel("models/players/leet.mdl")
util.PrecacheModel("models/players/alyx.mdl")



I dont think so…

Did you send it to the client?


 AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( 'shared.lua' )

ActualPlayers = 0
RoundStarted = 0
timer.Create( "TeamChosing", 10, 1, TeamMaker)

function GM:PlayerSpawn( ply )
    self.BaseClass:PlayerSpawn( ply )  
    ply:SetGravity  ( 1 )  
    ply:SetMaxHealth( 100, true )  
    ply:SetWalkSpeed( 190 )  
    ply:SetRunSpeed ( 235 ) 
	
	ActualPlayers = ActualPlayers + 1
	if ActualPlayers == 2 then
		if Roundstarted == 0 then
			RoundStarted = 1
			print("The Round will start now")
			timer.Start
		end
	end
	
end

function GM:PlayerLoadout( ply )
	
end

function GM:PlayerInitialSpawn( ply )
	   ply:PrintMessage( HUD_PRINTTALK, "Welcome, " .. ply:Name() .. "!" )
end



Thats my init.lua so i think so.

Try sending shared.lua first; before you send cl_init.lua.

Still dont work, always file not found.

That might happen if the file errors. Give us your console after you’ve started the server.

I can’t highlight it because Im on my phone, but an error in your init.lua, in your player spawn function, you’re just calling timer.Start

@rejax: I seen that and i fixed it myself before youre Answer, but Thanks.
Works now :>