setstats
View Cart

CS:GO SDK Automatically Assign Any Weapon to a Player On Spawn

Category: Source: CS:GO SDK
May 12, 2016
Full Text Tutorial and Notes:

If you are creating a training map focused on one weapon type such as ak-47, awp, deagle or revolver then you want to make sure the player spawns only with that weapon equipped.

You need to strip all weapons from player's inventory that are given to them by default and assign a weapon you want for them to spawn with.

For this to happen, you need to insert 1 game_player_equip entity into your map. Then you will be able to assign any weapon to a player upon spawn, automatically.

Step 1:

Enable Entity Tool (Shift+E):

Under Objects, scroll down to game_player_equip and select it:

Left click in perspective viewport to insert game_player_equip entity anywhere you want within the map:

Note: By inserting game_player_equip into your map, you will strip the player from any weapons on spawn.

Step 2:

Edit game_player_equip entity by selecting it and going into Object Properties (Alt+Enter) or double clicking on the entity:

Disable "SmartEdit":

Click on Add:

New box will pop up to enter a New Keyvalue. This is where you define which weapon you want the player to spawn with.

Here is what you need to input into each box:

  • Key: name of the weapon
  • Value: 1

Under Key property, input the name of the weapon you want to have the player spawn with.

Value property has to be set to 1.

Example of weapon_ak47:

Step 3:

Enter the name of the weapon you want the player to have. Here are all the weapon names you can use. These names have to be entered exactly how you see them here.

  • weapon_ak47
  • weapon_aug
  • weapon_awp
  • weapon_bizon
  • weapon_c4
  • weapon_cz75a
  • weapon_deagle
  • weapon_decoy
  • weapon_elite
  • weapon_famas
  • weapon_fiveseven
  • weapon_flashbang
  • weapon_g3sg1
  • weapon_galilar
  • weapon_glock
  • weapon_healthshot
  • weapon_hegrenade
  • weapon_hkp2000
  • weapon_incgrenade
  • weapon_knife
  • weapon_m249
  • weapon_m4a1
  • weapon_m4a1_silencer
  • weapon_mac10
  • weapon_mag7
  • weapon_molotov
  • weapon_mp7
  • weapon_mp9
  • weapon_negev
  • weapon_nova
  • weapon_p250
  • weapon_p90
  • weapon_revolver
  • weapon_sawedoff
  • weapon_scar20
  • weapon_sg556
  • weapon_smokegrenade
  • weapon_tagrenade
  • weapon_taser
  • weapon_tec9
  • weapon_ump45
  • weapon_usp_silencer
  • weapon_xm1014

You can also enable Entity Tool (Shift+E), use Objects drop down menu and scroll down to weapon_ to see proper names to enter.

Note: this is just to see which names you can use to enter into game_player_equip:

Step 4

If you want to remove any Keyvalue entries, select one and click on Delete:

Make sure you have "SmartEdit" disabled to delete.

Step 5:

Do not include buy zones if you do not want the player to purchase any weapons at the start.

Step 6:

Last, run a compile and test your map. You should now spawn with assigned weapons for both CT and T teams.

Read Next: CS:GO SDK Terminal Ballistics or How to Test if You Can Shoot Through Walls (Bullet Penetration)

Updated & Revised - Preproduction Blueprint: How to Plan Your Game Environments and Level Designs

© 2008-2017. All articles on World of Level Design™ are copyrighted.
Not to be reproduced without prior written consent.