mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-01-27 06:08:03 +03:00
Fix CS_OnBuy* not triggered from alias containing uppercase letters
This commit is contained in:
parent
60ebc444ab
commit
fafa1f11f0
@ -158,8 +158,11 @@ DETOUR_DECL_STATIC1(C_ClientCommand, void, edict_t*, pEdict) // void ClientComma
|
|||||||
if (get_pdata<CUnifiedSignals>(pEdict, SignalsDesc.fieldOffset).GetState() & SIGNAL_BUY) // Are we inside the buy zone?
|
if (get_pdata<CUnifiedSignals>(pEdict, SignalsDesc.fieldOffset).GetState() & SIGNAL_BUY) // Are we inside the buy zone?
|
||||||
{
|
{
|
||||||
AliasInfo info;
|
AliasInfo info;
|
||||||
|
char commandLowered[32];
|
||||||
|
|
||||||
if (ItemsManager.GetAliasInfosFromBuy(command, &info))
|
UTIL_StringToLower(command, commandLowered, sizeof(commandLowered));
|
||||||
|
|
||||||
|
if (ItemsManager.GetAliasInfosFromBuy(commandLowered, &info))
|
||||||
{
|
{
|
||||||
CurrentItemId = info.itemid;
|
CurrentItemId = info.itemid;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
|
#include <amtl/am-algorithm.h>
|
||||||
|
|
||||||
extern int MessageIdTextMsg;
|
extern int MessageIdTextMsg;
|
||||||
|
|
||||||
@ -47,3 +48,22 @@ bool UTIL_CheckForPublic(const char *publicname)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UTIL_StringToLower(const char *str, char *buffer, size_t maxlength)
|
||||||
|
{
|
||||||
|
auto length = ke::Min(strlen(str), maxlength - 1);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < length; ++i)
|
||||||
|
{
|
||||||
|
if (str[i] >= 'A' && str[i] <= 'Z')
|
||||||
|
{
|
||||||
|
buffer[i] = tolower(str[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buffer[i] = str[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer[length] = '\0';
|
||||||
|
}
|
@ -21,6 +21,7 @@ extern HLTypeConversion TypeConversion;
|
|||||||
bool UTIL_IsPlayer(edict_t *pPlayer);
|
bool UTIL_IsPlayer(edict_t *pPlayer);
|
||||||
void UTIL_TextMsg_Generic(edict_t* pPlayer, const char* message);
|
void UTIL_TextMsg_Generic(edict_t* pPlayer, const char* message);
|
||||||
bool UTIL_CheckForPublic(const char *publicname);
|
bool UTIL_CheckForPublic(const char *publicname);
|
||||||
|
void UTIL_StringToLower(const char *str, char *buffer, size_t maxlength);
|
||||||
|
|
||||||
#define GETINFOKEYBUFFER (*g_engfuncs.pfnGetInfoKeyBuffer)
|
#define GETINFOKEYBUFFER (*g_engfuncs.pfnGetInfoKeyBuffer)
|
||||||
#define SETCLIENTKEYVALUE (*g_engfuncs.pfnSetClientKeyValue)
|
#define SETCLIENTKEYVALUE (*g_engfuncs.pfnSetClientKeyValue)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user