Source SDK

Source SDK

[CS:GO] Give weapon with game_player_equip
How can I use the game_player_equip entity? I'm making a aim-training map for myself and I want it to strip my primary weapon when I shoot on the AK47 on the wall. Meaning if I have an awp in hands; and I shoot the ak-47 on the wall, the awp disappears and I equip an ak47.

Didn't see an option in the game_player_equip entity to choose weapon
< >
Showing 1-5 of 5 comments
76561198041347291 Jul 3, 2016 @ 11:41am 
When you place the entity, you have to turn off smart edit and hit Add.

In Key, you put the weapon's classname (e.g. weapon_awp, weapon_knife, etc...). Make sure to properly put the name or nothing will happen.
In Value, you put the amount of ammo you want to give to the weapon. Try not to use ridiculous values and stick with the original values you get when buying the weapon.
Click ok, turn smart edit back on, apply all, compile and you should be good to go. It is that easy.
Lård Fårtgåwt Jul 3, 2016 @ 11:54am 
Originally posted by Peter Brev:
When you place the entity, you have to turn off smart edit and hit Add.

In Key, you put the weapon's classname (e.g. weapon_awp, weapon_knife, etc...). Make sure to properly put the name or nothing will happen.
In Value, you put the amount of ammo you want to give to the weapon. Try not to use ridiculous values and stick with the original values you get when buying the weapon.
Click ok, turn smart edit back on, apply all, compile and you should be good to go. It is that easy.
thanks, did some searching on the wiki and found it 1 second after posting this ;P
Lård Fårtgåwt Jul 3, 2016 @ 2:31pm 
I have another issue now, bots are supposed to only have knives but when I put in a game_player_equip all bots now have ak's.. Also when I spawn, I get a lot of weapons dropped on me, for every player_equip entity I've put in (awp, aug etc). How can I set it so it ONLY gives when I click the button assigned to them?
Moltard Jul 3, 2016 @ 3:41pm 
Originally posted by hypr /H/:
I have another issue now, bots are supposed to only have knives but when I put in a game_player_equip all bots now have ak's.. Also when I spawn, I get a lot of weapons dropped on me, for every player_equip entity I've put in (awp, aug etc). How can I set it so it ONLY gives when I click the button assigned to them?
Check the flag "Use Only".

And put a game_player_equip with weapon_knife, that dont have the flag Use Only. And I think there is another new flag in csgo sdk to strip player everyround and give them the weapon, so check that one.

On round start, everyone get a knife and nothing else.

To strip the player after he shoot something, use a player_weaponstrip (it might not be in the sdk directly as it's an Half life 2 entity).
Put any point_entity in the map. Change the classname. With SmartEdit off add a key targetname and a value what_u_want

And on your button or whatever you want, you call the player_weaponstrip (with its name) and you use the input StripWeaponAndSuit
Bots work a little differently. Since you want bots to have knives only, then you could put a point_clientcommand or point_servercommand (if one does not work, just change it to the other), name it and in a logic_auto you put:
OnMapSpawn
*TheNameOfTheEntity*
Command
bot_knives_only 1
0.00

If none of these work, there is a good chance that you need to quickly toggle sv_cheats on then off.

If it is the case, then:
OnMapSpawn
*TheNameOfTheEntity*
Command
sv_cheats 1
0.00

OnMapSpawn
*TheNameOfTheEntity*
Command
bot_knives_only 1
0.01

OnMapSpawn
*TheNameOfTheEntity*
Command
sv_cheats 0
0.02
< >
Showing 1-5 of 5 comments
Per page: 1530 50

Date Posted: Jul 3, 2016 @ 10:20am
Posts: 5