View Single Post
nosoop
Veteran Member
Join Date: Aug 2014
Old 11-18-2019 , 11:18   Re: [TF2] Client game crash when the client get a weapon
Reply With Quote #5

Quote:
Originally Posted by PC Gamer View Post
I managed to get this working with the [TF2] Econ Data plugin written by the talented nosoop (link:https://forums.alliedmods.net/showthread.php?t=315011 )

It works good but has a 3 problems I need help with.

1. I have a tag mismatch with this piece of code:

2: I can't seem to find a way to remove only ONE existing cosmetic item before giving a new one. I can either remove all cosmetics first, or don't remove any. I opted to not remove any.

3. For some reason it will not allow me to give any saxxy class item. It gives error "Invalid entity (-1 - -1)" so I added a check for that.
1. The second argument to TF2Econ_GetItemSlot is already a TFClassType tag; keep it as-is instead of retagging it as an integer. On an additional note, do not use TF2_RemoveWeaponSlot with TF2Econ_GetItemSlot due to the differing "slot" mapping described here. Use TF2_GetPlayerLoadoutSlot from my fork of Powerlord's wearable tools or check the item's loadout slot with TF2Econ_GetItemSlot.

2. As in (1), use TF2_GetPlayerLoadoutSlot to find a wearable in a weapon slot. The wearable tools library also has natives to equip / remove wearables.

3. That's a game thing -- it internally takes the schema's item class and turns it into a class-appropriate entity (multiclass melees and shotguns, among others). Econ Data provides TF2Econ_TranslateWeaponEntForClass (calling the game's functions) for this; I know there's a pure SourcePawn version that someone else wrote floating around somewhere but I can't recall where it is at the moment.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline