Raised This Month: $ Target: $400
 0% 

[TF2] Trying to make the client to be forced to use weapon slot number 2.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
StormishJustice
Member
Join Date: May 2015
Location: In a mysterious place.
Old 07-25-2015 , 10:19   [TF2] Trying to make the client to be forced to use weapon slot number 2.
Reply With Quote #1

So i update red2robotv2 all day (or sometimes)

though i'm trying to make a command in red2robotv2 named sm_gauntlet (become a steel gauntlet only in ROBOTS!)

i removed those weapon slots (primary and secondary) but i want to make the command to force the player to use melee when becoming steel gauntlet, instead it switches to primary but stripped, pressing the melee weapon slot makes you use melee.

is there a way to force the client to use melee? help is appreciated.

Regards
- Stormish Justice
__________________
StormishJustice is offline
Send a message via AIM to StormishJustice Send a message via Yahoo to StormishJustice Send a message via Skype™ to StormishJustice
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 07-25-2015 , 14:41   Re: [TF2] Trying to make the client to be forced to use weapon slot number 2.
Reply With Quote #2

Did you strip ALL the weapons first, and then give them the melee only?

Check how TF2BWR does it (too lazy to check myself).
Potato Uno is offline
Requiesta
Senior Member
Join Date: May 2012
Location: Texas
Old 07-25-2015 , 15:41   Re: [TF2] Trying to make the client to be forced to use weapon slot number 2.
Reply With Quote #3

First, get the melee weapon on the player:

Code:
new iWeapon = GetPlayerWeaponSlot(iClient, 2);

Then force the player to switch to it:

Code:
EquipPlayerWeapon(iClient, iWeapon);
Obviously throw in some validation checks to make sure the plugin doesn't explode.
__________________
YouTuber, Modder, Accountant, and somehow I still enjoy programming after all that.

Check out my YouTube Channel.
Requiesta is offline
StormishJustice
Member
Join Date: May 2015
Location: In a mysterious place.
Old 07-25-2015 , 16:33   Re: [TF2] Trying to make the client to be forced to use weapon slot number 2.
Reply With Quote #4

Quote:
Originally Posted by Potato Uno View Post
Did you strip ALL the weapons first, and then give them the melee only?

Check how TF2BWR does it (too lazy to check myself).
I did only strip secondary and primary.
__________________
StormishJustice is offline
Send a message via AIM to StormishJustice Send a message via Yahoo to StormishJustice Send a message via Skype™ to StormishJustice
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 07-26-2015 , 02:13   Re: [TF2] Trying to make the client to be forced to use weapon slot number 2.
Reply With Quote #5

hook one of the weapon switch functions with sdkhooks and change the weapon back, sdk call resetweapon will help.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
StormishJustice
Member
Join Date: May 2015
Location: In a mysterious place.
Old 07-26-2015 , 07:38   Re: [TF2] Trying to make the client to be forced to use weapon slot number 2.
Reply With Quote #6

Quote:
Originally Posted by Requiesta View Post
First, get the melee weapon on the player:

Code:
new iWeapon = GetPlayerWeaponSlot(iClient, 2);

Then force the player to switch to it:

Code:
EquipPlayerWeapon(iClient, iWeapon);
Obviously throw in some validation checks to make sure the plugin doesn't explode.
This one helped.

thank you.
__________________
StormishJustice is offline
Send a message via AIM to StormishJustice Send a message via Yahoo to StormishJustice Send a message via Skype™ to StormishJustice
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode