Raised This Month: $12 Target: $400
 3% 

[TF2Items] Give Weapon (v3.14159, 11/29/2013)


Post New Thread Reply   
 
Thread Tools Display Modes
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 02-06-2013 , 07:15   Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
Reply With Quote #1001

Quote:
Originally Posted by FlaminSarge View Post
Phantom: I'm working on that as TF2Items WeaponReplace, though I cannot pull weapons from players' backpacks due to things not being updated and me having no idea how to fix them. I know it *is* possible to pull item data from a player's backpack, just that nothing on AM seems to do so at the moment.
The server only receives information on items the player has equipped on the client side.
__________________
asherkin is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 02-12-2013 , 07:15   Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
Reply With Quote #1002

But equipped for *any* class, not just their current class, no?
__________________
Bread EOTL GunMettle Invasion Jungle Inferno will break everything. Don't even ask.

All plugins: Randomizer/GiveWeapon, ModelManager, etc.
Post in plugin threads with questions.
Steam is for playing games.
You will be fed to javalia otherwise.
Psyduck likes replays.
FlaminSarge is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 02-12-2013 , 07:36   Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
Reply With Quote #1003

Quote:
Originally Posted by FlaminSarge View Post
But equipped for *any* class, not just their current class, no?
Indeed.
__________________
asherkin is offline
Seth.D
Member
Join Date: Apr 2011
Old 02-18-2013 , 04:45   Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
Reply With Quote #1004

Hello! Recently when I tried to give myself or others a weapon, he/she would be unable to use said weapon. For example, if I was a Heavy and my shotgun was active, then I gave myself a Pain Train, then I tried switching to the Pain Train, the game would immediately switch me back to the Shotgun. But since the Pain Train is a melee, if I had my fists out and I gave myself the Pain Train, I would have the Pain Train equipped. However, once I switch from the Pain Train back to something else, it won't let me switch back to the Pain Train again.

I hope I'm not being too confusing.
Seth.D is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 02-18-2013 , 21:20   Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
Reply With Quote #1005

Try using the latest beta version of TFDodgeball (or update TFDodgeball). There was a known issue that asherkin fixed at some point.

If you're not already running TFDodgeball, that issue should not come up, as I know no other extension that used the thing that it did... Sidewinder maybe?
__________________
Bread EOTL GunMettle Invasion Jungle Inferno will break everything. Don't even ask.

All plugins: Randomizer/GiveWeapon, ModelManager, etc.
Post in plugin threads with questions.
Steam is for playing games.
You will be fed to javalia otherwise.
Psyduck likes replays.

Last edited by FlaminSarge; 02-18-2013 at 21:20.
FlaminSarge is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 02-19-2013 , 18:36   Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
Reply With Quote #1006

Question about some of the coding, mainly this stuff in the GiveWeaponOfIndex stock:

PHP Code:
SetEntProp(entityProp_Send"m_iEntityLevel", (-128+11));
GetClientAuthString(clientstrSteamIDsizeof(strSteamID));
if (
StrEqual(strSteamID"STEAM_0:0:00000000"))
{
    
SetEntProp(entityProp_Send"m_iEntityQuality"8);

How would one go about adding in more details for the weapon such as attributes?

I was kind of reading along in the tf2items.inc file, and I saw this stuff:
PHP Code:
native TF2Items_SetLevel(Handle:hItemiEntityLevel);

native TF2Items_SetNumAttributes(Handle:hItemiNumAttributes);

native TF2Items_SetAttribute(Handle:hItemiSlotIndexiAttribDefIndexFloat:flValue); 
So I thought I'd try by myself to add in an attribute to this weapon, for example a particle effect. I tried this:

PHP Code:
GetClientAuthString(clientstrSteamIDsizeof(strSteamID));
if (
StrEqual(strSteamID"STEAM_0:0:00000000"))
{
    
SetEntProp(entityProp_Send"m_iEntityLevel"100);
    
SetEntProp(entityProp_Send"m_iSlotIndex"0); //I assume slot index refers to "this is the <1st/2nd/3rd/4th/5th/etc> attribute"
    
SetEntProp(entityProp_Send"m_iAttribDefIndex"134);
    
SetEntProp(entityProp_Send"m_flValue"1);

That obviously didn't work ingame, it just made me lose the weapon in the slot where this weapon was supposed to be. Obviously, the flValue isn't meant to go in the SetEntProp, I guess.

Any help on adding in an attribute/many attributes, on a "case" basis, based on a players Steam ID, would be great, and you could also apply it to the plugin (i.e. adding the Community Sparkle effect to Reag's Jar of Ants, or the Self-Made Khopesh Climber that I see has been coded in).
404UserNotFound is offline
Seth.D
Member
Join Date: Apr 2011
Old 02-19-2013 , 23:10   Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
Reply With Quote #1007

Quote:
Originally Posted by FlaminSarge View Post
Try using the latest beta version of TFDodgeball (or update TFDodgeball). There was a known issue that asherkin fixed at some point.

If you're not already running TFDodgeball, that issue should not come up, as I know no other extension that used the thing that it did... Sidewinder maybe?
Yep! That fixed the problem! Thanks a bunch!
Seth.D is offline
PBSGTS
Senior Member
Join Date: Nov 2011
Old 02-22-2013 , 04:39   Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
Reply With Quote #1008

Any idea why back attachments wouldn't be working? (ie. razorback)

It "gives" the item and replaces whatever was in that slot, but it doesn't appear on the player model or function (protect from backstabs).
PBSGTS is offline
JaCuS
New Member
Join Date: Nov 2012
Old 02-22-2013 , 18:19   Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
Reply With Quote #1009

World custom models stoped replacing. (after some recent tf2 update)
JaCuS is offline
MasterOfTheXP
Veteran Member
Join Date: Aug 2011
Location: Cloudbank
Old 02-23-2013 , 02:12   Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
Reply With Quote #1010

abrandnewday: Once a weapon's been given, you can't modify its attributes (although I think a TF2Items rewrite is planned that will make that possible) but you can try playing around with the TF2Items attributes natives here, before it's given:
PHP Code:
new Handle:hWeapon PrepareItemHandle(weaponLookupIndexTF2_GetPlayerClass(client));
// Here
new entity TF2Items_GiveNamedItem(clienthWeapon);
CloseHandle(hWeapon); 
Should be around line 1100. For an example of code you could try using there: (untested)
PHP Code:
new attribs TF2Items_GetNumAttributes(hWeapon);
TF2Items_SetNumAttributes(hWeaponattribs 1);
TF2Items_SetAttribute(hWeaponattribs1341.0); 
Quote:
Originally Posted by PBSGTS View Post
Any idea why back attachments wouldn't be working? (ie. razorback)

It "gives" the item and replaces whatever was in that slot, but it doesn't appear on the player model or function (protect from backstabs).
Works fine for me. Double check the server console, and make sure your Randomizer gamedata is updated.
__________________
Plugins / My Steam / TF2 Sandbox (plugin beta testing!)

Last edited by MasterOfTheXP; 02-23-2013 at 02:13. Reason: I accidentally a grammar
MasterOfTheXP is offline
Reply


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

Forum Jump


All times are GMT -4. The time now is 12:38.


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