Skip to content

Conversation

@JakubKosmaty
Copy link
Contributor

No description provided.

@R1KO
Copy link
Contributor

R1KO commented May 7, 2021

Может стоит это делать здесь?

https://github.com/FD-Forks/Shop-Core/blob/39b082045f6d3735d7c548c16b3611a2ef7d97ce/addons/sourcemod/scripting/shop/player_manager.sp#L339

но вообще зачем это?

@IL0co
Copy link
Collaborator

IL0co commented May 30, 2022

This function has already been completed, when transferring an item, we remove this item from the player’s inventory from the player (the player who transfers), thereby causing an event chain, in which there is a callback to turn off the item from the player.

RemoveItemEx(client, sItemId);

bool RemoveItemEx(int client, const char[] sItemId, int count = 1)
{
if (IsItemToggledEx(client, sItemId))
{
ToggleItemEx(client, sItemId, Toggle_Off);
}
return PlayerManager_RemoveItemEx(client, sItemId, count);
}

bool ToggleItemEx(int client, const char[] sItemId, ToggleState toggle, bool by_native = false, bool load = false)
{
if (!PlayerManager_ClientHasItemEx(client, sItemId))
{
return false;
}
ShopAction action = ItemManager_OnUseToggleItemEx(client, sItemId, by_native, toggle);
if (action == Shop_Raw)
{
return false;
}
return PlayerManager_ToggleItemEx(client, sItemId, action, load);
}

@IL0co IL0co requested a review from TiBarification May 30, 2022 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants