I mean, I looked at this tutorial
[media]http://www.youtube.com/watch?v=D-dvHFIyL5o[/media]
And its sequal, and everything I did was correct, or so it seems, but when I start up a server with the gamemode it just switches to sandbox mode, and it wont let me swtich it back, heres my files
shared.lua
[code]
GM.Name = "Testmod"
GM.Author = "N/A"
GM.Email = "N/A"
GM.Website = "N/A"
--This is a test of a gamemode
DeriveGamemode( "sandbox" )
function GM:Initialize()
self.BaseClass.Initialize( self )
end
[/code]
init.lua
[code]AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( 'shared.lua' )
// Serverside only stuff goes here
/*---------------------------------------------------------
Name: gamemode:PlayerLoadout( ply )
Desc: Give the player the default spawning weapons/ammo
---------------------------------------------------------*/
function GM:PlayerSpawn( ply )
self.BaseClass:PlayerSpawn( ply )
ply:SetGravity( 0,90 )
ply:MaxHealth( 125, true )
ply:SetWalkSpeed( 325 )
ply:SetRunSpeed( 525 )
end
function GM:PlayerLoadout( ply )
ply:StripWeapons()
ply:Give( "weapon_crowbar" )
ply:Give( "weapon_pistol" )
end
function GM:PlayerInitialSpawn( ply )
self.BaseClass:PlayerInitialSpawn( ply )
if ply:IsAdmin () then
ply:PrintMessage( HUD_PRINTTALK, "Testmod: Why hello thar!" )
end
end
[/code]
cl_init.lua
[code]include( 'shared.lua' )
// Clientside only stuff goes here[/code]
Where did I go wrong?
Any errors?
Yeah, it just starts up in sandbox and won't do anything, I'm trying to make it so you have nothing but a pistol and a crowbar, but I start off with all normal weapons in sandbox, and I don't know how to check for errors.
Did you remember to start your gamemode and not sandbox?
Yes, I select my gamemode but it just reverts to sandbox, I also tried sv_gamemode but it wont let me change it.
Whats the folder name? If it has a space in it, it wont work.
It did, let me test to see if it works now.
Alright It loaded now, but I got this error
[code]
ERROR: GAMEMODE:'PlayerSpawn' Failed: GamemodeTest/gamemode/init.lua:17: attempt to call method 'MaxHealth' (a nil value)
[/code]
[editline]01:07PM[/editline]
Also how would I make it so they have more ammo than just 18 shots?
[editline]01:14PM[/editline]
Also again, is there any code that will let me enable serverside fog?
on line 17 of init.lua replace
[lua]
ply:MaxHealth( 125, true )
[/lua]
with
[lua]
ply:SetMaxHealth( 125, true )
[/lua]
Sorry that was my alt, it used to work, and I just added some code to allow me to change the player model, but now I'm getting this error in console.
[code]
InitFastCopy: only 49% fast props. Bug?
Lua initialized (Lua 5.1)
Registering gamemode 'sandbox' derived from 'base'
Registering gamemode 'ZombieMassacre' derived from 'sandbox'
ERROR: Trying to derive entity sent_rg_bullet from non existant entity base_point!
[/code]
Sorry, you need to Log In to post a reply to this thread.