Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

мелкие исправления #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deathrun_mode_skillmaster.sma
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public dr_chosen_new_terrorist(id)
}
public Ham_PlayerPreThink_Pre(id)
{
if(id != g_iTerrorist || !is_user_alive(id)) return HAM_IGNORED;
if(g_iCurMode != g_iModeSkillMaster || id != g_iTerrorist || !is_user_alive(id)) return HAM_IGNORED;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Там DisableHamForward() есть.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Проглядел, потестирую этот момент.
А callfunc добавишь? Я использовал одно и то же название функции canBuy в разных плагинах и при открытии меню, вызывалась canBuy одновременно во всех плагинах, думаю с этим еще кто-нибудь столкнется.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделай один коммит для шопа на английском, по аналогии с моими коммитами.


new buttons = pev(id, pev_button);
new oldbuttons = pev(id, pev_oldbuttons);
Expand Down
12 changes: 7 additions & 5 deletions deathrun_shop.sma
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public native_add_item(plugin, params)
if(function[0])
{
// public CanBuyItem(id);
eItemInfo[ItemCanBuy] = CreateMultiForward(function, ET_CONTINUE, FP_CELL);
eItemInfo[ItemCanBuy] = get_func_id(function, plugin);
}

ArrayPushArray(g_aShopItems, eItemInfo);
Expand Down Expand Up @@ -144,7 +144,7 @@ Show_ShopMenu(id, page)
if(~eItemInfo[ItemTeam] & team) continue;

szNum[0] = i;
hCallback = (GetCanBuyAnswer(id, eItemInfo[ItemCanBuy]) == ITEM_ENABLED) ? -1 : g_hCallbackDisabled;
hCallback = (GetCanBuyAnswer(id, eItemInfo[ItemPlugin], eItemInfo[ItemCanBuy]) == ITEM_ENABLED) ? -1 : g_hCallbackDisabled;
formatex(szText, charsmax(szText), "%s %s \R\y$%d", eItemInfo[ItemName], g_szItemAddition, eItemInfo[ItemCost]);

menu_additem(menu, szText, szNum, eItemInfo[ItemAccess], hCallback);
Expand Down Expand Up @@ -176,7 +176,7 @@ public ShopMenu_Handler(id, menu, item)

new team = (1 << _:cs_get_user_team(id));

if((~eItemInfo[ItemTeam] & team) || GetCanBuyAnswer(id, eItemInfo[ItemCanBuy]) != ITEM_ENABLED)
if((~eItemInfo[ItemTeam] & team) || GetCanBuyAnswer(id, eItemInfo[ItemPlugin], eItemInfo[ItemCanBuy]) != ITEM_ENABLED)
{
client_print_color(id, print_team_default, "%s^1 %L", PREFIX, id, "DRS_CANT_BUY");
return PLUGIN_HANDLED;
Expand All @@ -201,10 +201,12 @@ public ShopMenu_Handler(id, menu, item)
Show_ShopMenu(id, item / 7);
return PLUGIN_HANDLED;
}
GetCanBuyAnswer(id, callback)
GetCanBuyAnswer(id, plugin, callback)
{
if(!callback) return ITEM_ENABLED;
new return_value; ExecuteForward(callback, return_value, id);
callfunc_begin_i(callback, plugin);
callfunc_push_int(id);
new return_value = callfunc_end();
return return_value;
}
public ShopDisableItem()
Expand Down