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

[L4D & L4D2] Gear Transfer (2.33) [28-Jan-2024]


Post New Thread Reply   
 
Thread Tools Display Modes
imyz
Junior Member
Join Date: Dec 2013
Old 01-27-2022 , 11:17   Re: [L4D & L4D2] Gear Transfer (2.19) [19-Oct-2021]
Reply With Quote #361

Quote:
Originally Posted by thewintersoldier97 View Post
I got a similar bug while using Item Hint before, do you also using it? It has been fixed on the current version of the plugin though.
No. And I didn't even know this 'Item Hint' you mentioned above.

As a matter of fact, including those plugins shipped with SourceMod by default, I have 26 plugins in total installed in my dedicated server. So, if you count this one and those xxx_shove plugins in by SilverShot, there is no room left anymore for other plugins at all

Last edited by imyz; 01-27-2022 at 11:19.
imyz is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 01-28-2022 , 21:23   Re: [L4D & L4D2] Gear Transfer (2.19) [19-Oct-2021]
Reply With Quote #362

The reason for items being attached to feet was a change to enable the weapon selection equip icon animation. I think the older version before 2.0 might of had this and after someone reported the equip icon was missing in 2.0 I've added it back in but I still don't know why the feet bug is happening now. It seems to be a lot rarer than it was after adding back in. Maybe one day I can compare the old versions and this to see if anything can be done. The whole bug makes no sense.
__________________
Silvers is offline
NoroHime
Veteran Member
Join Date: Aug 2016
Location: bed
Old 02-19-2022 , 13:04   Re: [L4D & L4D2] Gear Transfer (2.19) [19-Oct-2021]
Reply With Quote #363

could you fire event "give_weapon" and "weapon_given"?
they should work like game work with thirdparty plugin
__________________

Last edited by NoroHime; 02-19-2022 at 13:05.
NoroHime is offline
Zheldorg
Junior Member
Join Date: Aug 2020
Old 02-24-2022 , 08:15   Re: [L4D & L4D2] Gear Transfer (2.19) [19-Oct-2021]
Reply With Quote #364

Bug Report: if I exchange identical items with a bot, then the exchange can be done as much as you like (while the weapon changes to the main one with each exchange), but for example, exchanging a grenade for a Molotov will lead to the fact that I cannot exchange the received Molotov with any of the bots . It is required to go to idle and back in order to have a second opportunity to exchange.
I will clarify that items from other slots can still be tried to be exchanged until they also bug. An already bugged item cannot

P.S. I found that for me, as client 1, Event_WeaponDrop is called first, then OnWeaponEquip twice and again Event_WeaponDrop, which apparently resets the values in the cells g_iClientItem, g_iClientType. I still do not understand what the second Event_WeaponDrop calls, it is called before line 1481: if( IsFakeClient(target) ), but after line 1469: if( IsFakeClient(client) ). Here is the output of test PrintToChatAll:
PHP Code:
Zheldorg :  123
TransferItem step
TransferItem item 357
TransferItem item_ref 
-2065071771
TransferItem type 3
TransferItem type 3
TransferItem step 1
TransferItem step 2
TransferItem step IG
GiveItem step
Zheldorg 
обменял бомбу у Coach
Coach отдал желчь толстяка Zheldorg
Event_WeaponDrop step client 1
OnDrop step client 1
OnWeaponEquip client 1 weapon 514
OnWeaponEquip classname weapon_vomitjar
OnWeaponEquip ClientItem 
-2074799614
OnWeaponEquip ClientType 5
OnWeaponEquip client 1 weapon 514
OnWeaponEquip classname weapon_vomitjar
OnWeaponEquip ClientItem 
-2074799614
OnWeaponEquip ClientType 5
Event_WeaponDrop step client 1
OnDrop step client 1
OnWeaponEquip client 4 weapon 357
OnWeaponEquip classname weapon_pipe_bomb
OnWeaponEquip ClientItem 
-2065071771
OnWeaponEquip ClientType 4
TransferItem step finish
TransferItem client 1
ID0Item 0Type 0 
TransferItem client 1
ID1Item -2095976014Type 6 
TransferItem client 1
ID2Item -2068115104Type 1 
P.S.S line 1556: int CreateAndEquip(int client, int type), on the left for different types, on the right exchange of identical objects. It can be seen that in the second option, OnWeaponEquip and Event_WeaponDrop for GivePlayerItem() are not called, but a new entity is created because it is clear that the if( entity != INVALID_ENT_REFERENCE ) condition is triggered

PHP Code:
CreateAndEquip step client 1                           CreateAndEquip step client 1
Event_WeaponDrop step client 1                         
OnDrop step client 1                                   
OnWeaponEquip client 1 weapon 357                      
OnWeaponEquip classname weapon_molotov                 
OnWeaponEquip ClientItem 
-2065071771                   
OnWeaponEquip ClientType 3                             
CreateAndEquip GivePlayerItem step client 1            CreateAndEquip GivePlayerItem step client 1
OnWeaponEquip client 1 weapon 357                      OnWeaponEquip client 1 weapon 357
OnWeaponEquip classname weapon_molotov                 OnWeaponEquip classname weapon_molotov
OnWeaponEquip ClientItem 
-2065071771                   OnWeaponEquip ClientItem -2065047195
OnWeaponEquip ClientType 3                             OnWeaponEquip ClientType 3
Event_WeaponDrop step client 1                         Event_WeaponDrop step client 1
OnDrop step client 1                                   OnDrop step client 1
CreateAndEquip EquipPlayerWeapon step client 1         CreateAndEquip EquipPlayerWeapon step client 1
GiveItem IsFakeClient Finish step client 1             GiveItem IsFakeClient Finish step client 1
GiveItem Front IsFakeClient step client 1              GiveItem Front IsFakeClient step client 1
OnWeaponEquip client 2 weapon 517                      OnWeaponEquip client 2 weapon 484
OnWeaponEquip classname weapon_vomitjar                OnWeaponEquip classname weapon_molotov
OnWeaponEquip ClientItem 
-2065845755                   OnWeaponEquip ClientItem -2104466972
OnWeaponEquip ClientType 5                             OnWeaponEquip ClientType 3
GiveItem Front IsFakeClient step target 2              GiveItem Front IsFakeClient step target 2
TransferItem step finish                               TransferItem step finish
TransferItem client 1
ID0Item 0Type 0             TransferItem client 1ID0Item -2065047195Type 3 
TransferItem client 1
ID1Item -2137743001Type 6   TransferItem client 1ID1Item -2137743001Type 6 
TransferItem client 1
ID2Item -2033082097Type 1   TransferItem client 1ID2Item -2033082097Type 1 
P.S.S.S void OnDrop(int client, int item), found out that the right case never passes if( item == g_iClientItem[client][i] )

P.S.S.S.S Everything looks like this: in "void GiveItem()" the client is a live player, the target is a bot, "if( transferType == METHOD_SWAP )" fires as "true", if( IsFakeClient(client) ) goes to "else ", detach the item from the bot RemovePlayerItem(target, ent_t) and destroy RemoveEdict(ent_t), call CreateAndEquip(client, type_t - 1), in the called one, create an object identical to the type that we destroyed earlier int entity = GivePlayerItem(client, classname), and here oddities arise , GivePlayerItem raises the event void Event_WeaponDrop in it, it tries to drop the object we have (this is clear from the comparison of int item = event.GetInt("propid") with g_iClientItem[client][' current slot']) since we did not untie our object beforehand (RemovePlayerItem(client, ent_c) will be called much later), then GivePlayerItem calls OnWeaponEquip to bind the newly created item to us, then EquipPlayerWeapon(client, entity) re-attaches the newly created item by calling OnWeaponEquip and then generates an event "Event_WeaponDrop", trying to drop an entity , although the item will not actually be dropped, in the OnDrop() function called next, the g_iClientItem and g_iClientType for the current item will be reset to zero, which will not allow the item to be exchanged again.

If the exchange is identical items, another nuance arises, int entity = GivePlayerItem(client, classname) will create an item, but will not call either Event_WeaponDrop or OnWeaponEquip. As a result, since the entity is correct, after if( entity != INVALID_ENT_REFERENCE ) EquipPlayerWeapon(client, entity) will be called, it will already call OnWeaponEquip for the newly created item, as well as Event_WeaponDrop but for the old non-detached item, in the OnDrop() function in the line if( item == g_iClientItem[client][i] ) will not match and g_iClientItem and g_iClientType will not be set to null. In general, all // TRANSFER code looks problematic from these shoving items.

OUTCOME
One line comment and a few line breaks seem to solve the problem. Attach l4d_gear_transfer.sp
Attached Files
File Type: sp Get Plugin or Get Source (l4d_gear_transfer_Test.sp - 116 views - 81.2 KB)
File Type: sp Get Plugin or Get Source (l4d_gear_transfer.sp - 120 views - 78.9 KB)

Last edited by Zheldorg; 03-02-2022 at 08:21.
Zheldorg is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-01-2022 , 18:54   Re: [L4D & L4D2] Gear Transfer (2.19) [19-Oct-2021]
Reply With Quote #365

Quote:
Originally Posted by Zheldorg View Post
Bug Report

---
Sorry I don't understand what should be changed. Can you clarify. The non-test version you posted is identical to the last release and the test version only has debug prints.



Code:
2.20 (01-Mar-2022)
    - Plugin now fires the "give_weapon" and "weapon_given" events. Requested by "NoroHime".
__________________
Silvers is offline
Krufftys Killers
Senior Member
Join Date: Jan 2014
Old 03-01-2022 , 22:15   Re: [L4D & L4D2] Gear Transfer (2.20 ) [01-Mar-2022]
Reply With Quote #366

After the update started getting an error

L 03/01/2022 - 20:41:56: Error log file session closed.
L 03/01/2022 - 20:43:46: SourceMod error session started
L 03/01/2022 - 20:43:46: Info (map "rocketbuild1") (file "C:\servers\kruffty\left4dead2\addons\sou rcem od\logs\errors_20220301.log")
L 03/01/2022 - 20:43:46: [SM] Exception reported: Invalid game event handle 0 (error 4)
L 03/01/2022 - 20:43:46: [SM] Blaming: l4d_gear_transfer.smx
L 03/01/2022 - 20:43:46: [SM] Call stack trace:
L 03/01/2022 - 20:43:46: [SM] [0] Event.SetInt
L 03/01/2022 - 20:43:46: [SM] [1] Line 2197, /home/forums/content/files/8/5/7/7/8/191210.attach::FireEventsGeneral
L 03/01/2022 - 20:43:46: [SM] [2] Line 1535, /home/forums/content/files/8/5/7/7/8/191210.attach::GiveItem
L 03/01/2022 - 20:43:46: [SM] [3] Line 1827, /home/forums/content/files/8/5/7/7/8/191210.attach::TimerAutoGive

Last edited by Silvers; 03-01-2022 at 22:30. Reason: Shortened error
Krufftys Killers is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-01-2022 , 22:33   Re: [L4D & L4D2] Gear Transfer (2.21) [01-Mar-2022]
Reply With Quote #367

Thanks, should be fixed.
__________________
Silvers is offline
Zheldorg
Junior Member
Join Date: Aug 2020
Old 03-02-2022 , 08:39   Re: [L4D & L4D2] Gear Transfer (2.19) [19-Oct-2021]
Reply With Quote #368

Quote:
Originally Posted by Silvers View Post
Sorry I don't understand what should be changed. Can you clarify. The non-test version you posted is identical to the last release and the test version only has debug prints.
I'm sorry, I don't understand how I do it, I attached the wrong file, now I've updated it.
Zheldorg is offline
ZzZombo
Member
Join Date: May 2012
Location: Ravenholm
Old 05-03-2022 , 11:28   Re: [L4D & L4D2] Gear Transfer (2.21) [01-Mar-2022]
Reply With Quote #369

Could the bots pick items up ONLY naturally, w/o them magically appearing in their possession? I have seen them actually pick grenades and stuff they do not pick on their own by issuing the use command on many occasions, and I like that so much over the forced solution.
ZzZombo is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-03-2022 , 15:10   Re: [L4D & L4D2] Gear Transfer (2.21) [01-Mar-2022]
Reply With Quote #370

Quote:
Originally Posted by ZzZombo View Post
Could the bots pick items up ONLY naturally, w/o them magically appearing in their possession? I have seen them actually pick grenades and stuff they do not pick on their own by issuing the use command on many occasions, and I like that so much over the forced solution.
If you want to code it in I'll add to the main plugin. Reason I didn't do it like that is you would have to force them to walk to the grenade/items to pick up, because most of the time they wouldn't be close enough and walk past it, either using VScript to command a bot to that position (won't support L4D1) or L4D2_OnFindScavengeItem which would require Left4DHooks. Neither of which is something I really want to do.
__________________

Last edited by Silvers; 05-03-2022 at 15:10.
Silvers 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 08:51.


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