Quote:
Originally Posted by WATCH_D0GS UNITED
Are you trying to return text (string) or numbers about the Lenght?
In case of numbers, replace %s by %d
We could not load your plugin so we cannot check it.
|
sorry, I sent the wrong code. the text is not good for some reason. picture attached
Code:
#include <amxmodx>
#include <amxmisc>
#include <regex>
new const g_szPluginName[] = "Map Tiers";
new const g_szPluginVersion[] = "v1.0.0";
new const g_szPluginAuthor[] = "Cram";
new const g_szINIFileName[] = "maptiers.ini";
new g_szCurrentMap[32];
new g_szTier[16];
new g_szLength[16];
public plugin_init()
{
register_plugin(g_szPluginName, g_szPluginVersion, g_szPluginAuthor);
register_clcmd("say /maptier", "cmdShowCurrentMapTier");
register_clcmd("say /tier", "cmdShowCurrentMapTier");
get_mapname(g_szCurrentMap, charsmax(g_szCurrentMap));
getCurrentMapTier();
register_dictionary("kz_tier.txt");
}
public cmdShowCurrentMapTier(id)
{
client_print_color(0, print_team_default, "%L", LANG_PLAYER, "KZ_TIER_CHAT", g_szCurrentMap, g_szTier, g_szLength);
return PLUGIN_CONTINUE;
}
stock getCurrentMapTier()
{
new szINIFilePath[256];
get_configsdir(szINIFilePath, charsmax(szINIFilePath));
format(szINIFilePath, charsmax(szINIFilePath),"%s/%s", szINIFilePath, g_szINIFileName);
// Make sure each line in the INI is written properly "<anything><whitespace><anything>"
// Otherwise, the line will be ignored and will be logged
new const szPattern[] = "(.+)(\w)(.+)$";
new pFile = fopen(szINIFilePath, "r");
new szFileLine[64];
new iFaultyLines = 0;
format(g_szTier, charsmax(g_szTier), "%L", LANG_PLAYER, "KZ_TIER");
format(g_szLength, charsmax(g_szLength), "%L", LANG_PLAYER, "KZ_LENGTH");
while(fgets(pFile, szFileLine, charsmax(szFileLine)))
{
if(regex_match(szFileLine, szPattern))
{
new szLeft[32], szRight[16];
split(szFileLine, szLeft, charsmax(szLeft), szRight, charsmax(szRight), " ");
if(equal(szLeft, g_szCurrentMap))
{
copy(g_szTier, charsmax(g_szTier), szRight);
copy(g_szLength, charsmax(g_szLength), g_szLength);
break;
}
}
else
iFaultyLines++;
}
fclose(pFile);
if(iFaultyLines > 0)
{
// Log all of the imporperly formatted lines in your INI file to fix rather than cause an error
new szLog[256];
format(szLog, charsmax(szLog), "[MAP TIERS] In: %s, number of improperly formatted lines: (%d)", g_szINIFileName, iFaultyLines);
server_print(szLog);
log_amx(szLog);
}
}
Code:
[en]
KZ_TIER_CHAT = ^4[KZ TIERS] ^1Current: ^3%s^1, Tier: ^3%s^1, Length: ^3%s^1.
KZ_TIER = Not Specified
KZ_LENGTH = Not Specified
Code:
hb_dropzone Easy Short
https://forums.alliedmods.net/showth...highlight=tier