Sandbox Error

Hey guys
I need to derive my gamemode from sandbox, however when i do this im constantly given this message in console every time i try to spawn a player:
[lua]ERROR: GAMEMODE:‘PlayerSpawn’ Failed: sandbox/gamemode/init.lua:40: stack overflow[/lua]
Line 40 of that file reads
[lua]self.BaseClass.PlayerSpawn( self, pl )[/lua]
This is rather annoying as it means i can’t give a player joining any weapons or anything.

Help appreciated

Show me your Gamemode init.lua please

Ok here it is
[lua]AddCSLuaFile( “cl_init.lua” ) //Tell the server that the client need to download cl_init.lua
AddCSLuaFile( “shared.lua” ) //Tell the server that the client need to download shared.lua
AddCSLuaFile( “cl_modelmenu.lua” )

include( ‘shared.lua’ ) //Tell the server to load shared.lua

function GM:PlayerInitialSpawn( ply )
RunConsoleCommand( “zs_menu” )
RunConsoleCommand( “team_1” )
end

function GM:PlayerLoadout( ply )
if ply:Team() == 1 then

	ply:Give( "weapon_physgun" )
	ply:Give( "gmod_tool" )
	ply:Give( "weapon_pistol" )
	ply:GiveAmmo( "50", "pistol" )
	
end

end

function team1( ply )
ply:SetTeam( 1 )
ply:Spawn()

end

concommand.Add( “team_1”, team1 )

concommand.Add( “zs_setmodel”, function( ply, cmd, args )

if args[1] then  
    ply:SetModel( args[1] );  
end  

end );

– Brings up the Menu by pressing F1
function GM:ShowHelp( ply )
ply:ConCommand( “zs_help” )
end

function SchoolShow( ply )
ply:ConCommand( “zs_spawnmenu” )
end
hook.Add(“ShowSpare1”, “School”, SchoolShow)

function SchoolShow( ply )
ply:ConCommand( “zs_menu” )
end
hook.Add(“ShowSpare2”, “School”, SchoolShow)

[/lua]

You did not set the Args. And what makes the end at 38 ?

The function passed to concommand.Add.

So any enlightening comments or will i just have to leave out the spawnmenu from the gamemode?

Try


self.BaseClass:PlayerSpawn( ply )

Make sure ply is defined in the function arguments.

Ohwargh. Sorry for my Post. Did not read carefully

Bah, still no luck with it, probably just a random ass Gmod error, i’m not that great so rather than embarking on a long journey to solve the problem, ill just re-install Gmod. Nice and easy for the non Lua savy to understand.

Thanks for reply’s anyway

Have you:

[lua]
function GM:PlayerSpawn( ply )

self.BaseClass:PlayerSpawn( ply );

ply:SetGravity( 0.75 );
ply:SetMaxHealth( 100, true );

ply:SetWalkSpeed( 200 );
ply:SetRunSpeed( 250 );

end
[/lua]

Anywhere in your script? Presumingly your init.lua

You know what Horsey I completely forgot about the player spawn function shakes head. Ill add that in and give it a shot, thanks for the reply.

I presumed you had it already :confused: No wonder your getting a stack overflow.