This commit is contained in:
zaCade 2018-02-22 15:32:24 +01:00
commit b594a074fc
2 changed files with 57 additions and 6 deletions

View File

@ -116,7 +116,7 @@
/**
* The max length of any config string value.
*/
#define CONFIG_MAX_LENGTH 32
#define CONFIG_MAX_LENGTH 64
/**
* @section Config file reference aliases.

View File

@ -113,9 +113,30 @@ ZMarketLoad()
if(zmarketcommand[0])
{
WeaponsGetName(weaponindex, weaponname, sizeof(weaponname));
if (FindCharInString(zmarketcommand, ',') != -1)
{
int idx;
int lastidx;
while ((idx = FindCharInString(zmarketcommand[lastidx], ',')) != -1)
{
char out[16];
char fmt[8];
Format(fmt, sizeof(fmt), "%%.%ds", idx);
Format(out, sizeof(out), fmt, zmarketcommand[lastidx]);
RegConsoleCmd(out, ZMarketBuyCommand, weaponname);
lastidx += ++idx;
if (FindCharInString(zmarketcommand[lastidx], ',') == -1 && zmarketcommand[lastidx+1] != '\0')
RegConsoleCmd(zmarketcommand[lastidx], ZMarketBuyCommand, weaponname);
}
}
else
{
RegConsoleCmd(zmarketcommand, ZMarketBuyCommand, weaponname);
}
}
}
g_bZMarketCommandInitialized = true;
}
@ -132,6 +153,35 @@ public Action:ZMarketBuyCommand(client, argc)
for (new weaponindex = 0; weaponindex < size; weaponindex++)
{
WeaponsGetZMarketCommand(weaponindex, zmarketcommand, sizeof(zmarketcommand));
if (FindCharInString(zmarketcommand, ',') != -1)
{
int idx;
int lastidx;
while ((idx = FindCharInString(zmarketcommand[lastidx], ',')) != -1)
{
if (!strncmp(command, zmarketcommand[lastidx], idx))
{
WeaponsGetName(weaponindex, weaponname, sizeof(weaponname));
ZMarketEquip(client, weaponname);
return Plugin_Handled;
}
lastidx += ++idx;
if (FindCharInString(zmarketcommand[lastidx], ',') == -1 && zmarketcommand[lastidx+1] != '\0')
{
if (!strncmp(command, zmarketcommand[lastidx], idx))
{
WeaponsGetName(weaponindex, weaponname, sizeof(weaponname));
ZMarketEquip(client, weaponname);
return Plugin_Handled;
}
}
}
}
else
{
if(StrEqual(command, zmarketcommand))
{
WeaponsGetName(weaponindex, weaponname, sizeof(weaponname));
@ -139,6 +189,7 @@ public Action:ZMarketBuyCommand(client, argc)
return Plugin_Handled;
}
}
}
return Plugin_Handled;
}