I've been using the simple Fretta base found at [url]http://wiki.garrysmod.com/?title=Lua:Fretta[/url] and I can't seem to get my classes working. As of now I can run the game mode and choose teams, but it always just spawns me with a pistol and as the default player model in hl2 (the grayed out freeman).
[b]Code: [/b]
My Shared.lua
[lua]
GM.Name = "fretta deathmatch" //What is your Gamemode's name?
GM.Author = "William" // Who authored it?
GM.Email = "" //Your email?
GM.Website = "" //Website, only if you feel it
GM.Data = {}
DeriveGamemode( "fretta" )
IncludePlayerClasses() // Automatically includes files in "gamemode/player_class"
GM.TeamBased = true // Team based game or a Free For All game?
GM.AllowAutoTeam = true
GM.AllowSpectating = true
GM.SecondsBetweenTeamSwitches = 10
GM.GameLength = 15
GM.RoundLimit = 10 // Maximum amount of rounds to be played in round based games
GM.VotingDelay = 5 // Delay between end of game, and vote. if you want to display any extra screens before the vote pops up
GM.NoPlayerSuicide = false
GM.NoPlayerDamage = false
GM.NoPlayerSelfDamage = false // Allow players to hurt themselves?
GM.NoPlayerTeamDamage = false // Allow team-members to hurt each other?
GM.NoPlayerPlayerDamage = false // Allow players to hurt each other?
GM.NoNonPlayerPlayerDamage = false // Allow damage from non players (physics, fire etc)
GM.NoPlayerFootsteps = false // When true, all players have silent footsteps
GM.PlayerCanNoClip = false // When true, players can use noclip without sv_cheats
GM.TakeFragOnSuicide = false // -1 frag on suicide
GM.MaximumDeathLength = 10 // Player will respawn if death length > this (can be 0 to disable)
GM.MinimumDeathLength = 5 // Player has to be dead for at least this long
GM.AutomaticTeamBalance = false // Teams will be periodically balanced
GM.ForceJoinBalancedTeams = false // Players won't be allowed to join a team if it has more players than another team
GM.RealisticFallDamage = false
GM.AddFragsToTeamScore = false // Adds player's individual kills to team score (must be team based)
GM.NoAutomaticSpawning = false // Players don't spawn automatically when they die, some other system spawns them
GM.RoundBased = true // Round based, like CS
GM.RoundLength = 60 * 2 // Round length, in seconds
GM.RoundPreStartTime = 5 // Preperation time before a round starts
GM.RoundPostLength = 5 // Seconds to show the 'x team won!' screen at the end of a round
GM.RoundEndsWhenOneTeamAlive = false // CS Style rules
GM.EnableFreezeCam = false // TF2 Style Freezecam
GM.DeathLingerTime = 3 // The time between you dying and it going into spectator mode, 0 disables
GM.SelectModel = true // Can players use the playermodel picker in the F1 menu?
GM.SelectColor = true // Can players modify the colour of their name? (ie.. no teams)
GM.PlayerRingSize = 48 // How big are the colored rings under the player's feet (if they are enabled) ?
GM.HudSkin = "SimpleSkin"
GM.ValidSpectatorModes = { OBS_MODE_CHASE, OBS_MODE_IN_EYE, OBS_MODE_ROAMING }
GM.ValidSpectatorEntities = { "player" } // Entities we can spectate
GM.CanOnlySpectateOwnTeam = false // you can only spectate players on your own team
TEAM_HUMAN = 1
TEAM_Killaz = 2
function GM:CreateTeams()
if ( !GAMEMODE.TeamBased ) then return end
team.SetUp( TEAM_HUMAN, "Human Dudes", Color( 50, 255, 50 ), true )
team.SetSpawnPoint( TEAM_HUMAN, { "info_player_start", "info_player_terrorist", "info_player_rebel", "info_player_deathmatch" } )
team.SetClass( class_human, { "Human" } ) // "Human" is the class we want players to use
team.SetUp( TEAM_Killaz, "KILLAZ", Color( 50, 255, 50 ), true )
team.SetSpawnPoint( TEAM_Killaz, { "info_player_start", "info_player_counterterrorist", "info_player_combine", "info_player_deathmatch" } )
team.SetClass( class_killa, { "killa" } ) // "Human" is the class we want players to use
team.SetUp( TEAM_SPECTATOR, "Spectators", Color( 200, 200, 200 ), true )
team.SetSpawnPoint( TEAM_SPECTATOR, { "info_player_start", "info_player_terrorist", "info_player_counterterrorist", "info_player_combine", "info_player_rebel" } )
end
[/lua]
My class for the Human Dudes team:
[lua]local CLASS = {}
CLASS.DisplayName = "Revolver Dude"
CLASS.WalkSpeed = 200
CLASS.CrouchedWalkSpeed = 0.2
CLASS.RunSpeed = 300
CLASS.DuckSpeed = 0.2
CLASS.JumpPower = 100
CLASS.PlayerModel = "models/player/breen.mdl"
CLASS.DrawTeamRing = true
CLASS.DrawViewModel = true
CLASS.CanUseFlashlight = true
CLASS.MaxHealth = 75
CLASS.StartHealth = 75
CLASS.StartArmor = 0
CLASS.RespawnTime = 0 // 0 means use the default spawn time chosen by gamemode
CLASS.DropWeaponOnDie = false
CLASS.TeammateNoCollide = false
CLASS.AvoidPlayers = false // Automatically avoid players that we're no colliding
CLASS.Selectable = true // When false, this disables all the team checking
CLASS.FullRotation = false // Allow the player's model to rotate upwards, etc etc
function CLASS:Loadout( pl )
pl:Give( "weapon_crowbar" )
pl:Give( "weapon_357" )
end
function CLASS:OnSpawn( pl )
end
function CLASS:OnDeath( pl, attacker, dmginfo )
end
function CLASS:Think( pl )
end
function CLASS:Move( pl, mv )
end
function CLASS:OnKeyPress( pl, key )
end
function CLASS:OnKeyRelease( pl, key )
end
function CLASS:ShouldDrawLocalPlayer( pl )
return false
end
function CLASS:CalcView( ply, origin, angles, fov )
end
player_class.Register( "Human", CLASS )
[/lua]
My class for the KILLAZ team
[lua]
local CLASS = {}
CLASS.DisplayName = "killa"
CLASS.WalkSpeed = 400
CLASS.CrouchedWalkSpeed = 0.2
CLASS.RunSpeed = 600
CLASS.DuckSpeed = 0.2
CLASS.JumpPower = 200
CLASS.PlayerModel = "models/player/alyx.mdl"
CLASS.DrawTeamRing = true
CLASS.DrawViewModel = true
CLASS.CanUseFlashlight = true
CLASS.MaxHealth = 100
CLASS.StartHealth = 100
CLASS.StartArmor = 0
CLASS.RespawnTime = 0 // 0 means use the default spawn time chosen by gamemode
CLASS.DropWeaponOnDie = false
CLASS.TeammateNoCollide = false
CLASS.AvoidPlayers = false // Automatically avoid players that we're no colliding
CLASS.Selectable = true // When false, this disables all the team checking
CLASS.FullRotation = false // Allow the player's model to rotate upwards, etc etc
function CLASS:Loadout( pl )
pl:Give( "weapon_357" )
end
function CLASS:OnSpawn( pl )
end
function CLASS:OnDeath( pl, attacker, dmginfo )
end
function CLASS:Think( pl )
end
function CLASS:Move( pl, mv )
end
function CLASS:OnKeyPress( pl, key )
end
function CLASS:OnKeyRelease( pl, key )
end
function CLASS:ShouldDrawLocalPlayer( pl )
return false
end
function CLASS:CalcView( ply, origin, angles, fov )
end
player_class.Register( "killa", CLASS )
[/lua]
You can ignore the comments, I just left them in there from the tutorial.
[lua]TEAM_HUMAN = 1
TEAM_Killaz = 2
function GM:CreateTeams()
if ( !GAMEMODE.TeamBased ) then return end
team.SetUp( TEAM_HUMAN, "Human Dudes", Color( 50, 255, 50 ), true )
team.SetSpawnPoint( TEAM_HUMAN, { "info_player_start", "info_player_terrorist", "info_player_rebel", "info_player_deathmatch" } )
team.SetClass( TEAM_HUMAN, { "Human" } ) // "Human" is the class we want players to use
team.SetUp( TEAM_Killaz, "KILLAZ", Color( 50, 255, 50 ), true )
team.SetSpawnPoint( TEAM_Killaz, { "info_player_start", "info_player_counterterrorist", "info_player_combine", "info_player_deathmatch" } )
team.SetClass( TEAM_Killaz, { "killa" } ) // "Human" is the class we want players to use
team.SetUp( TEAM_SPECTATOR, "Spectators", Color( 200, 200, 200 ), true )
team.SetSpawnPoint( TEAM_SPECTATOR, { "info_player_start", "info_player_terrorist", "info_player_counterterrorist", "info_player_combine", "info_player_rebel" } )
end[/lua]
The first argument of team.SetClass needs to be the class number, TEAM_HUMAN and TEAM_Killaz.
My classes are in gamemode/player_class. I'm gonna try CowThing's fix
[b] Edit: [/b]
Yeah that worked, thanks Cow.
If i make a second class, does fretta automatically generate a class selection menu?
Sorry, you need to Log In to post a reply to this thread.