AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [TF2Items] Give Weapon (v3.14159, 11/29/2013) (https://forums.alliedmods.net/showthread.php?t=141962)

asherkin 02-06-2013 07:15

Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
 
Quote:

Originally Posted by FlaminSarge (Post 1888304)
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.

FlaminSarge 02-12-2013 07:15

Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
 
But equipped for *any* class, not just their current class, no?

asherkin 02-12-2013 07:36

Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
 
Quote:

Originally Posted by FlaminSarge (Post 1892936)
But equipped for *any* class, not just their current class, no?

Indeed.

Seth.D 02-18-2013 04:45

Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
 
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.

FlaminSarge 02-18-2013 21:20

Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
 
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?

404UserNotFound 02-19-2013 18:36

Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
 
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).

Seth.D 02-19-2013 23:10

Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
 
Quote:

Originally Posted by FlaminSarge (Post 1897313)
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!

PBSGTS 02-22-2013 04:39

Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
 
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).

JaCuS 02-22-2013 18:19

Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
 
World custom models stoped replacing. (after some recent tf2 update)

MasterOfTheXP 02-23-2013 02:12

Re: [TF2Items] Give Weapon (v3.14, 01/23/2013)
 
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 (Post 1899423)
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.


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

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