ok so my gamemode that made isn't working right cause i keep getting this 1 error that i don't know how to fix. I've tried to change the dir to where it's located but still no luck
here's the code
[z0mbie8killer|2|STEAM_0:0:41374263] Lua Error:
Couldn't include file 'shared.lua' (File not found) (@gamemodes/turbopuncher/gam
emode/cl_init.lua (line 1))
but the cl_init.lua is like this inside
include("shared.lua")
idk how to fix this but if any of you know how to plz comment back thank you!
What's in your shared.lua?
Make sure you have some code in that file, same happens for me with empty lua files when you try and include
i had reset everything in the past and now i'm still getting the same error
here's what's in the shared.lua now
______________________________
GM.name = "turbo puncher"
GM.author = "z0mbie8killer"
GM.email = "nope"
GM.webiste = "don't have 1 :/"
team.SetUp(0, "The Turbo Puncher", Color (255,0,0) )
team.SetUp(1, "Jaguar S.W.A.T Team", Color (0,0,0) )
function GM:Initialize()
self.BaseClass.Initialize( self )
end
________________________________
that black line isn't in there but that's what's in the shared.lua
Just an interjection OP, you can use {code}{/code} tags
(use [ and ] instead of { and } by the way, just had to use them to demonstrate it)
Example:
[code]GM.name = "turbo puncher"
GM.author = "z0mbie8killer"
GM.email = "nope"
GM.website = "don't have 1 :/"
team.SetUp(0, "The Turbo Puncher", Color (255,0,0) )
team.SetUp(1, "Jaguar S.W.A.T Team", Color (0,0,0) )
function GM:Initialize()
self.BaseClass.Initialize( self )
end[/code]
AddCSLuaFile("shared.lua") in init.lua
i'm now going to put what i have in the folders now these ^ aren't apart of the file ether
|
include("shared.lua")
include("player.lua")
in cl_init ^
|
local ply = FindMetaTable{}
local teams = {}
teams[0] = {name = The Turbo Puncher, color = Vector( .8, 0, .0), weapons {asdfsadf}
function ply:SetGamemodeTeam( n )
if not team [n] retrun end
self:SetTeam ( n )
self:SetPlayerColor( teams[n].color )
ply:GiveGamemodeWeapons()
player.GetByID( 1 ):GiveAmmo(100, "", ture )
end
ply:GiveGamemodeWeapons()
local n = self:Team()
for k, wep n pairs(teams[n].weapons) do
self:Give(wep)
for g, ammo in pairs (teams[n].weapons) do
self:GiveAmmo(100, "", true
end
end
end
in player.lua ^
|
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
include("player.lua")
function GM:PlayerConnect( name, ip )
print("Player: " ..name.. ", has joined the game")
end
function GM:PlayerInitialSpawn( ply )
print("Player: " .. ply:Nick().. ", has spawned")
ply:SetGamemodeTeam( 0 )
end
function GM:PlayerSpawn( ply )
ply:GiveGamemodeWeapons()
ply:SetModel("models/player/Combine_Soldier.mdl")
end
end
player_manger.OnPlayerSpawn( pl )
player_manger.RunClass( pl, "spawn" )
end
function GM:PlayerAuthed( ply, steamID, uniqueID )
print("Player: " .. ply:Nick() .. ", has been authed")
end
function GM:PlayerModel( ply )
ply:SetModel("models/player/Combine_Soldier.mdl")
end
in init.lua ^
|
DEFINE_BASECLASS( "player_default" )
function PLAYER:Spawn()
BaseClasse.Spawn( self )
end
player_manger.RegisterClass( "yourclass", PLAYER, "player_default")
end
player_class.lua (this is in a folder called Player_Class ^
|
[editline]15th January 2014[/editline]
| these are in there ether and the ends aren't right ether there tabed
p.s. the last time i fixed this is that i deleted everthing and retyped it all i want to know how to get rid of this error forever plz help
[editline]15th January 2014[/editline]
ok i got everything working all i had to do is recode everything that i made now i'm getting this error plz help
Couldn't Load Init Script: 'turbopuncher/gamemode/cl_init.lua'
Did you AddCSLuaFile player.lua?
[QUOTE=Chessnut;43554067]Did you AddCSLuaFile player.lua?[/QUOTE] just did nothing changed still getting the same error
[z0mbie8killer|2|STEAM_0:0:41374263] Lua Error:
Couldn't include file 'shared.lua' (File not found) (@gamemodes/turbopuncher/gam
emode/cl_init.lua (line 1))
[z0mbie8killer|2|STEAM_0:0:41374263] Lua Error:
Couldn't include file 'player.lua' (File not found) (@gamemodes/turbopuncher/gam
emode/cl_init.lua (line 2))
Why don't you ever use capital letters for anything?
Just saying, you got some syntax errors which would cause this not to work.
fixed it friend helped me i know a lot of people are getting this error so here's what you have to do
instead of typing
[CODE] include("shared")[/CODE]
type this instead
[CODE] include
= print "shared"[/CODE]
i might make a video of this the only problem is when i started the server it said the ulx was messed up
and i had to change all the base gamemode's shared to the second code idk if this will work for other people going to need to test it out
You know that, what you have done, won't fix anything right?
That is very.. Very stupid to do.
well it was worth a try without trying and testing will not get me anywhere and i still haven't tested it out yet give me a chance
[editline]17th January 2014[/editline]
WORKED :D but now i'm getting this error :(
[CODE][ERROR] expected near ','
1. unknown - gamemodes/turbopuncher/gamemode/shared.lua:0[/CODE]
[ERROR] expected near '{'
1. unknown - gamemodes/turbopuncher/gamemode/player.lua:0
Your post containing all your code contains syntax errors among other things. Functions are called like so: functionName( param1, param2 ) instead of using {}
The player metatable is "Player".
[code]local ply = FindMetaTable( "Player" )[/code]
Some of your methods are referencing the metatable instead of self.
You will most likely find it easier to work with teams by creating a wrapper for the teams library.
[url]http://wiki.garrysmod.com/page/team[/url]
i'll try that and i've been watching these videos so i'm not very good at coding lua i'm really just
learning
[video=youtube;_d8rZnQtUJE]https://www.youtube.com/watch?v=_d8rZnQtUJE[/video]
Sorry, you need to Log In to post a reply to this thread.