Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding

Reply
 
Thread Tools Display Modes
Old 05-17-2012, 04:18 AM   #1
hello123
 
Join Date: Aug 2011
Reputation: 20
Posts: 336
Wierd problem!

Hello!
I'm making this system, that when you get a new weapon, the old one gets removed..
Its acting pretty strange though.
Everytime I get the new weapon, the old weapon's viewmodel keep being there.
Ok, the code works like this:
Code:
case 2:
	{
	if (Weapon_OwnsThisType("weapon_pistol") )
	{
	RemovePlayerItem(Weapon_OwnsThisType("weapon_pistol") );
	}
	GiveNamedItem( "weapon_357" );
	break;
	}
case 3:
	{
		if (Weapon_OwnsThisType("weapon_357") )
			{
		RemovePlayerItem(Weapon_OwnsThisType("weapon_357") );
			}
		GiveNamedItem( "weapon_shotgun" );
		break;
	}
Everytime you get the new weapon, the old get removed, pretty straightforward, right?
But!
http://cloud.steampowered.com/ugc/56...537830CF522E7/
As you can see, the view models of the old weapon keeps being there..
hello123 is offline  
Reply With Quote
Old 05-17-2012, 04:12 PM   #2
WIllSmith190
 
Join Date: Apr 2010
Reputation: 2
Posts: 93
Are you removing or adding first? The code inside RemovePlayerItem looks like this:

-If weapon is active
--Holster
--Stop thinking
-If last weapon is the removed weapon
--Set the last weapon to NULL
-return Weapon_Detach

Make sure your code doesn't conflict with this process. I can't really tell, because the switch condition isn't posted.

Check to make sure the function doesn't fail, as far as I can tell, Weapon_Detach is what removes the item visually, and may be failing. You could also add it into your code before you remove the item.
WIllSmith190 is offline   Reply With Quote
Old 05-17-2012, 05:19 PM   #3
hello123
 
Join Date: Aug 2011
Reputation: 20
Posts: 336
I'm using the "remove" before it gets the new weapon.
But yeah, thanks! I'll check it out and post problems here, if any ^^
hello123 is offline   Reply With Quote
Reply

Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding


Thread Tools
Display Modes

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



All times are GMT -7. The time now is 02:36 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2012, All Rights Reserved.