Cstrike: Remove CS_OnGetItemPrice forward (reverted from commit 33a7d74b6da2ca4dcb621e9b306c386ba040571e)
This is actually not possible to have a proper system to allow this. This is two majors problems: - The item price text can't be changed, whatever old and VGUI menu (it's either harcoded in config file or in client binary) - Once you open VGUI menu, to know if user has enough money to select an item, client relies on the current HUD money value, this means, since we can't directly changed price, before opening the menu, money needs to be somehow faked and restored once closed. It's awful. Overall it can't work properly, and at the end current forward doesn't make sense. If an author wanted to have its own prices, the only only way would to force players to use old menu, then overwriting the whole buy menu, so you would be able to display what you want exactly.
This commit is contained in:
@ -23,7 +23,6 @@ void CtrlDetours_Natives(bool set);
|
||||
int ForwardInternalCommand = -1;
|
||||
int ForwardOnBuy = -1;
|
||||
int ForwardOnBuyAttempt = -1;
|
||||
int ForwardOnGetItemPrice = -1;
|
||||
|
||||
int *UseBotArgs;
|
||||
const char **BotArgs;
|
||||
@ -260,18 +259,6 @@ DETOUR_DECL_MEMBER2(AddAccount, void, int, amount, bool, bTrackChange) // void C
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (ForwardOnGetItemPrice != -1)
|
||||
{
|
||||
int client = G_HL_TypeConversion.cbase_to_id(this);
|
||||
|
||||
cell price[1]; *price = -amount;
|
||||
cell preparedCell = MF_PrepareCellArrayA(price, sizeof(price), true);
|
||||
|
||||
if (MF_IsPlayerAlive(client) && MF_ExecuteForward(ForwardOnGetItemPrice, client, CurrentItemId, preparedCell) > 0)
|
||||
{
|
||||
amount = -*price;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DETOUR_MEMBER_CALL(AddAccount)(amount, bTrackChange);
|
||||
|
@ -34,7 +34,6 @@ extern IGameConfig *CommonConfig;
|
||||
extern int ForwardInternalCommand;
|
||||
extern int ForwardOnBuy;
|
||||
extern int ForwardOnBuyAttempt;
|
||||
extern int ForwardOnGetItemPrice;
|
||||
|
||||
typedef edict_t* (*CreateNamedEntityFunc)(string_t iszClassname);
|
||||
typedef void* (*UTIL_FindEntityByStringFunc)(void* pStartEntity, const char *szKeyword, const char *szValue);
|
||||
|
@ -65,18 +65,16 @@ void OnPluginsLoaded()
|
||||
ForwardInternalCommand = MF_RegisterForward("CS_InternalCommand", ET_STOP, FP_CELL, FP_STRING, FP_DONE);
|
||||
ForwardOnBuy = MF_RegisterForward("CS_OnBuy" , ET_STOP, FP_CELL, FP_CELL, FP_DONE);
|
||||
ForwardOnBuyAttempt = MF_RegisterForward("CS_OnBuyAttempt" , ET_STOP, FP_CELL, FP_CELL, FP_DONE);
|
||||
ForwardOnGetItemPrice = MF_RegisterForward("CS_OnGetItemPrice" , ET_STOP, FP_CELL, FP_CELL, FP_ARRAY, FP_DONE);
|
||||
|
||||
// Checking whether such public forwards are used in plugins.
|
||||
// Resetting variable to -1 to avoid running unnecessary code in ClientCommand.
|
||||
if (!UTIL_CheckForPublic("CS_InternalCommand")) { ForwardInternalCommand = -1; }
|
||||
if (!UTIL_CheckForPublic("CS_OnBuy")) { ForwardOnBuy = -1; }
|
||||
if (!UTIL_CheckForPublic("CS_OnBuyAttempt")) { ForwardOnBuyAttempt = -1; }
|
||||
if (!UTIL_CheckForPublic("CS_OnGetItemPrice")) { ForwardOnGetItemPrice = -1; }
|
||||
|
||||
// And enable/disable detours when necessary.
|
||||
ToggleDetour_ClientCommands(ForwardInternalCommand != -1 || ForwardOnBuy != -1 || ForwardOnBuyAttempt != -1 || ForwardOnGetItemPrice != -1);
|
||||
ToggleDetour_BuyCommands(ForwardOnBuy != -1 || ForwardOnGetItemPrice != -1);
|
||||
ToggleDetour_ClientCommands(ForwardInternalCommand != -1 || ForwardOnBuy != -1 || ForwardOnBuyAttempt != -1);
|
||||
ToggleDetour_BuyCommands(ForwardOnBuy != -1);
|
||||
|
||||
// Search pev/vtable offset automatically.
|
||||
TypeConversion.init();
|
||||
|
Reference in New Issue
Block a user