• Spawning With the Wrong Weapons
    2 replies, posted
My question is why do i keep spawning with the gravity gun, stun stick,smg,pistol,crowbar etc i looked on wiki.garrysmod.com and i copy and pasted there commands in into my gamemode lua files to test it out it turns out that doesnt work and i was wondering on what i could do do fix it. im trying to run a WWII server but I can't as you see when its doing this :/ heres the lua file that im coding (*its a fretta gamemode) please respond as soon as you can my freinds and server guests are really starting to get mad D: local CLASS = {} CLASS.DisplayName = "Revolver Dude" CLASS.WalkSpeed = 400 CLASS.CrouchedWalkSpeed = 0.2 CLASS.RunSpeed = 600 CLASS.DuckSpeed = 0.2 CLASS.JumpPower = 200 CLASS.PlayerModel = "models/player/breen.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( "Human", CLASS )
This obviously doesen't have anything to do with it, as it doesent say anything about the other weapons. I took a look at the 'Base' gamemode files, using GCFScape, and took a look at the PlayerLoadout function. [lua]/*--------------------------------------------------------- Name: gamemode:PlayerLoadout( ) Desc: Give the player the default spawning weapons/ammo ---------------------------------------------------------*/ function GM:PlayerLoadout( pl ) pl:GiveAmmo( 255, "Pistol", true ) pl:GiveAmmo( 90, "SMG1", true ) pl:GiveAmmo( 1, "grenade", true ) pl:GiveAmmo( 32, "Buckshot", true ) pl:GiveAmmo( 16, "357", true ) pl:Give( "weapon_stunstick" ) pl:Give( "weapon_crowbar" ) pl:Give( "weapon_pistol" ) pl:Give( "weapon_smg1" ) pl:Give( "weapon_frag" ) pl:Give( "weapon_physcannon" ) //pl:Give( "weapon_physgun" ) // Switch to prefered weapon if they have it local cl_defaultweapon = pl:GetInfo( "cl_defaultweapon" ) if ( pl:HasWeapon( cl_defaultweapon ) ) then pl:SelectWeapon( cl_defaultweapon ) end end[/lua] You'll want to override this function.
sorry I'm new to this kind of thing how would i override this? (Do I need to make them spawn with ammo to make this work? just wondering)
Sorry, you need to Log In to post a reply to this thread.