Multiple questions mostly involving the location of a command autoexec file inside of a gamemode

First of all, thanks for the unban.

Now then I got a bunch of questions.

  1. Is there some kind of universal ammo type? If so how do I make the player spawn with 4 clips of whatever weapon he has on his hands? (I know its possible)
  2. Is there any kind of autoexec.cfg file for the game mode? I want to enforce mp_falldamage 1 on any server that runs the game mode im working on.
  3. How do I force corpses to stay a bit longer after a player has respawned? (Not forever but like 15 seconds more)
  4. How do I force players to wait 5 seconds before respawning?

And a more complex question, how do I make that upon player death a corpse will drop a random entity?

function GM:PlayerDeath( ply )
   local deathdrop= { "cw2scopething", "cw2ammothing", "cw2scopething", "cw2supressorthing", "cw2scopething", "cw2scopething", "cw2bipodlol"}
   local randomdeathdrop= table.Random(deathdrop)
   getpos (ply)

That was fake code, I know its shit, Im new to lua and I want to learn thats just how I imaginate it working.

Player:GiveAmmo(10, game.GetAmmoName(Player:GetActiveWeapon():GetPrimaryAmmoType()))

  1. You can run RunConsoleCommand(“mp_falldamage”, “1”) in your gamemode code.

local tDropItems = {

local iItemCount = #tDropItems

function GM:PlayerDeath(pPlayer)
	local pEntity = ents.Create(tDropItems[math.random(1, iItemCount)])
	if (pEntity:IsValid()) then

  1. This thread should at least solve part of your answer.

  2. This should get you started:


local playerPrimaryWeapon = ply:GetWeapon(randomPrimary)

local primaryWeaponAmmoType = playerPrimaryWeapon:GetPrimaryAmmoType()

local primaryWeaponClipSize = playerPrimaryWeapon:GetMaxClip1()

ply:GiveAmmo(primaryWeaponClipSize * 3, primaryWeaponAmmoType, true)

I fixed that issue thanks to YM_Industries this should add clips instead of a specific amount of bullets.
Tho thanks for the example on the command code, I was stuck wondering why it didn’t work, I forgot to add “” to the code lol.

Also thanks for the code for dropping the items, it works like a charm, I only have 2 issues with it, but im going to try to resolve them myself.
The issues are that the entities dont dissapear, so it starts lagging after a bit.
It also seems like doi_disable_all_attachments_on_spawn is not working properly.

You can create a timer inside of the hook to remove the entity if it’s still around