Quote
OVDE IZBACUJE ERROR - stock AMX_GetBaseCount(E_AMX_TABLE:table, &base, &count)
{
P:3("AMX_GetBaseCount called: %i, %i, %i", _:table, base, count);
switch (table)
{
case AMX_TABLE_PUBLICS:
{
base = AMX_HEADER_PUBLICS;
count = (AMX_HEADER_NATIVES - base) / 8;
}
case AMX_TABLE_NATIVES:
{
base = AMX_HEADER_NATIVES;
count = (AMX_HEADER_LIBRARIES - base) / 8;
}
case AMX_TABLE_LIBRARIES:
{
base = AMX_HEADER_LIBRARIES;
count = (AMX_HEADER_PUBVARS - base) / 8;
}
case AMX_TABLE_PUBVARS:
{
base = AMX_HEADER_PUBVARS;
count = (AMX_HEADER_TAGS - base) / 8;
}
case AMX_TABLE_TAGS:
{
base = AMX_HEADER_TAGS;
count = (AMX_HEADER_NAMETABLE - base) / 8;
}
default:
{
base = 0;
count = 0;
}
}
}
#define AMX_GetPublicEntry(%0) AMX_GetEntry(AMX_TABLE_PUBLICS,%0)
#define AMX_GetNativeEntry(%0) AMX_GetEntry(AMX_TABLE_NATIVES,%0)
#define AMX_GetLibraryEntry(%0) AMX_GetEntry(AMX_TABLE_LIBRARIES,%0)
#define AMX_GetPubvarEntry(%0) AMX_GetEntry(AMX_TABLE_PUBVARS,%0)
#define AMX_GetTagEntry(%0) AMX_GetEntry(AMX_TABLE_TAGS,%0)
stock AMX_GetEntry(E_AMX_TABLE:table, idx, &buffer, const pattern[] = "")
{
P:3("AMX_GetEntry called: %i, %i, %i, \"%s\"", _:table, idx, buffer, pattern);
new
OVDE IZBACUJE ERROR - base,
count;
if (table == AMX_TABLE_PUBLICS && idx == 0)
{
// Special case where we can use native functions.
idx = funcidx(pattern);
if (idx == -1)
{
idx = 0;
}
else
{
buffer = idx * 8 + AMX_HEADER_PUBLICS;
return idx + 1;
}
}
stock AMX_GetNamePrefix(E_AMX_TABLE:table, idx, buffer, pattern)
{
P:3("AMX_GetNamePrefix called: %i, %i, \"%s\", %i", _:table, idx, buffer, pattern);
new
OVDE IZBACUJE ERROR - base,
count;
AMX_GetBaseCount(table, base, count);
if (idx < count)
{
new
addr,
pos = idx * 8 + base + 4;
do
{
// Get the address of the string.
#emit LREF.S.pri pos
#emit STOR.S.pri addr
// Get the 4 bytes 5 bytes before this position.
addr += AMX_BASE_ADDRESS;
#emit LREF.S.pri addr
#emit STOR.S.pri addr
++idx;
if (addr == pattern)
{
#emit LREF.S.pri pos
#emit STOR.S.pri addr
AMX_ReadString(AMX_BASE_ADDRESS + addr, buffer);
return idx;
}
pos += 8;
}
while (idx < count);
}
return 0;
}