I have a plugin which sometimes gives a weapon_healthshot item to a random player :
PHP Code:
int item = GivePlayerItem(client, "weapon_healthshot");
A few seconds after using this item my server crashes in about 1 out of 5 cases.
To analyse the problem I added a PlayerRunCmd prehook, where I iterate through m_hMyWeapons[64] of the player and print all not item_* and weapon_* entities.
Here is the log:
PHP Code:
L 06/15/2021 - 20:34:16: [test.smx] Give"weapon_healthshot" with index 138 to player Fin.
L 06/15/2021 - 20:39:16: [test.smx] Improper item "trigger_teleport " with index 138 in the invenory of Fin.
The second line is printed in the PlayerRunCmd hook a few seconds after the player uses weapon_healthshot, then the server crashes.
My question is how such random items get to the inventory and why they have the same index as the weapon_healthshot which the plugin gives to players.
Is it caused by GivePlayerItem?
Yesterday I got a lot of "Improper..." for a player before the server crashed. Strange thing was that somewhere in the middle of the messages there were ~2 seconds without these logs and then all the rest "Improper..." were printed with another entity name. So the player at the begining had a weapon_healthshot in the inventory, then it was replaced to trigger_teleport and then to prop_dynamic_glow. The crash happend when the player left the game.