• Error with including files
    9 replies, posted
[B]So I have this code:[/B] [B]Clientside: [/B] [lua] include( 'shared.lua' ) include( 'crp_welcome_message_cl.lua' ) include( 'crp_hud_cl.lua' ) [/lua] [B]Serverside: [/B] [lua] AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) AddCSLuaFile( "crp_welcome_message_cl.lua" ) AddCSLuaFile( "crp_hud_cl.lua" ) include( 'shared.lua' ) function GM:PlayerSpawn( ply ) self.BaseClass:PlayerSpawn( ply ) ply:SetGravity ( 1 ) ply:SetMaxHealth( 100, true ) ply:SetWalkSpeed( 200 ) ply:SetRunSpeed ( 270 ) ply:Give( "weapon_physcannon" ) ply:Give( "weapon_fists" ) if ply:IsAdmin() then ply:Give( "weapon_physgun" ) end end function GM:PlayerLoadout( ply ) end function GM:PlayerInitialSpawn( ply ) ply:PrintMessage( HUD_PRINTTALK, "Welcome, " .. ply:Name() .. "!" ) ply:SetTeam( 1 ) end [/lua] [B]And for some reason I have this error, any fix?[/B] [B]Error: [/B] [lua] Couldn't include file 'crp_welcome_message_cl.lua' (File not found) (@gamemodes/colonyrp/gamemode/cl_init.lua (line 3)) [/lua]
Do you have any code in that file? Is the file in the gamemode folder??
Yes it is called "crp_welcome_message_cl.lua" [editline]1st April 2015[/editline] I don't have any code though...
Which is why it won't include. I don't know why, but unless the file has anything in it, including won't work. Check for yourself, just put some random code in there.
I am still having the error... I put "local isRunning = true" into it, but still the same error
[QUOTE=VortexZ;47439207]I am still having the error... I put "local isRunning = true" into it, but still the same error[/QUOTE] If you are using Sublime Text 3, it can also cause this error when creating new files and that, exit sublime and restart your server.
I am using Notepad++
Restart your server than?
[QUOTE=Author.;47439139]Which is why it won't include. I don't know why, but unless the file has anything in it, including won't work. Check for yourself, just put some random code in there.[/QUOTE] In most programming languages, a file has to have content for it to be recognised.
Thank you man!
Sorry, you need to Log In to post a reply to this thread.