Raised This Month: $ Target: $400
 0% 

Issues with Client_SetActiveWeapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zeroibis
Veteran Member
Join Date: Jun 2007
Old 05-26-2016 , 13:20   Issues with Client_SetActiveWeapon
Reply With Quote #1

When using Client_SetActiveWeapon() to switch a player to their knife the knife is invisible.

Lets say that you even remove the knife from a player completely and then run:

Code:
Client_GiveWeapon(client, "weapon_knife", true);
Even in this case they will get their knife it will switch to it but it will be invisible. I do not understand why this is occurring.
__________________
zeroibis is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-27-2016 , 04:51   Re: Issues with Client_SetActiveWeapon
Reply With Quote #2

Use fake client command to slot x
__________________
Neuro Toxin is offline
SM9
Veteran Member
Join Date: Sep 2013
Location: United Kingdom
Old 05-27-2016 , 07:25   Re: Issues with Client_SetActiveWeapon
Reply With Quote #3

Hello, you can use my Item API, You have 2 choices if you do so.

If you want to give the player a knife you can choose to switch to the knife as soon as you give him it.

Example 1:
PHP Code:
CSGOItems_GiveWeapon(iClient"weapon_knife"__CS_SLOT_KNIFE
Result 1: Client receives a knife and is automatically equipped, and active weapon is switched to knife. If he has any other knife equipped it will automatically remove it using a crash free method, Saving you a lot of messy code, you can use this 1 line to do everything.

Example 2:
PHP Code:
CSGOItems_SetActiveWeapon(iClientiWeapon); 
Result 2: The clients active weapon is instantly switched to the weapon index specified, this is a custom method which makes an SDKCall to the internal Weapon_Switch function and then forces the active weapon netprop.

Let me know how it works out for you!

Last edited by SM9; 05-27-2016 at 07:27.
SM9 is offline
zeroibis
Veteran Member
Join Date: Jun 2007
Old 05-30-2016 , 00:19   Re: Issues with Client_SetActiveWeapon
Reply With Quote #4

Quote:
Originally Posted by Neuro Toxin View Post
Use fake client command to slot x
Will Try.

Quote:
Originally Posted by xCoderx View Post
Hello, you can use my Item API, You have 2 choices if you do so.

If you want to give the player a knife you can choose to switch to the knife as soon as you give him it.

Example 1:
PHP Code:
CSGOItems_GiveWeapon(iClient"weapon_knife"__,  CS_SLOT_KNIFE
Result 1: Client receives a knife and is automatically equipped, and active weapon is switched to knife. If he has any other knife equipped it will automatically remove it using a crash free method, Saving you a lot of messy code, you can use this 1 line to do everything.

Example 2:
PHP Code:
CSGOItems_SetActiveWeapon(iClientiWeapon); 
Result 2: The clients active weapon is instantly switched to the weapon index specified, this is a custom method which makes an SDKCall to the internal Weapon_Switch function and then forces the active weapon netprop.

Let me know how it works out for you!
I would try this but I am coding for cs:s not cs:go. If the first solution does not work I will take a look at these stocks and see if there is anything that might work in css in there.
__________________
zeroibis is offline
sdz
Senior Member
Join Date: Feb 2012
Old 05-30-2016 , 00:25   Re: Issues with Client_SetActiveWeapon
Reply With Quote #5

Code:
FakeClientCommand(client, "use weapon_knife");

Last edited by sdz; 05-30-2016 at 00:25.
sdz is offline
zeroibis
Veteran Member
Join Date: Jun 2007
Old 05-30-2016 , 00:45   Re: Issues with Client_SetActiveWeapon
Reply With Quote #6

Thank you that works!!
__________________

Last edited by zeroibis; 05-30-2016 at 00:48.
zeroibis is offline
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 00:52.


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