Picking up only certain weapons automatically

Grab your favourite IDE and tinker with the innards of game engines

Picking up only certain weapons automatically

Postby nanoxax on Tue Oct 25, 2011 11:35 pm

I made it so that when ever the player wants to pick up a weapon they have to press the use key to pick it up. But there is a weapon that I am using for hands in the game and I only want the hands to be picked up on the map start. I already have this coding:
http://pastebin.com/prkNGVN3

And I was wondering what I could add to that to make it so weapon_hands could be picked up automatically.

Also if there is a console command for this to automatically equip one of the weapons that would be even better.
nanoxax
Member
Member
 
Joined: Tue Oct 18, 2011 8:14 pm

Re: Picking up only certain weapons automatically

Postby Post-Hoc on Wed Oct 26, 2011 12:15 am

maybe use a console command, with a point_clientcommand.

'give weapon_hands'
Image
User avatar
Post-Hoc
Regular
Regular
 
Joined: Sun Oct 09, 2011 11:01 pm
Location: Sweden

Re: Picking up only certain weapons automatically

Postby nanoxax on Wed Oct 26, 2011 1:07 am

The problem with that is though is when give weapon_hands is put into the console, the weapon just spawns at your feet.
nanoxax
Member
Member
 
Joined: Tue Oct 18, 2011 8:14 pm

Re: Picking up only certain weapons automatically

Postby Post-Hoc on Wed Oct 26, 2011 2:33 am

That's interesting, well I'm not a coder but perhaps there is an easy way to make it so that this code doesn't affect the hands weapon?
Image
User avatar
Post-Hoc
Regular
Regular
 
Joined: Sun Oct 09, 2011 11:01 pm
Location: Sweden

Re: Picking up only certain weapons automatically

Postby dark0r on Wed Oct 26, 2011 12:14 pm

Restore the CBaseCombatWeapon::DefaultTouch back to how it was originally and just add the following at the top of the function:

Code: Select all
if(V_strcmp(GetClassname(), "weapon_hands"))
    return;
dark0r
Been Here A While
Been Here A While
 
Joined: Sat Mar 25, 2006 10:16 am
Location: de_hell

Re: Picking up only certain weapons automatically

Postby nanoxax on Wed Oct 26, 2011 8:01 pm

Thanks :D
nanoxax
Member
Member
 
Joined: Tue Oct 18, 2011 8:14 pm

Return to Programming

Who is online

Users browsing this forum: No registered users