Hi . How to add colorchat to this ?
Something like this (the red text is team-color) :
Code:
Last maps played are: fy_dust, fy_snow, de_dust2, de_nuke, cs_italy
PHP Code:
#include <amxmodx>
#define MAX_MAPS 5
new g_MapNames[MAX_MAPS][34]
public plugin_init()
{
register_plugin("last played maps", "0.2", "ConnorMcLeod")
register_clcmd("amx_lastmaps", "lastmapsCmd")
register_clcmd("say /lastmaps", "lastmapsSayCmd")
}
public plugin_cfg()
{
new szLastMapsFile[64]
get_localinfo("amxx_configsdir", szLastMapsFile, 63)
format(szLastMapsFile, 63, "%s/lastmaps.txt", szLastMapsFile)
new File = fopen(szLastMapsFile, "rt")
new i
new Temp[34]
if(File)
{
for(i=0; i<MAX_MAPS; i++)
{
if(!feof(File))
{
fgets(File, Temp, 33)
replace(Temp, 33, "^n", "")
formatex(g_MapNames[i], 33, Temp)
}
}
fclose(File)
}
delete_file(szLastMapsFile)
new CurrentMap[34]
get_mapname(CurrentMap, 33)
File = fopen(szLastMapsFile, "wt")
if(File)
{
formatex(Temp, 33, "%s^n", CurrentMap)
fputs(File, Temp)
for(i=0; i<MAX_MAPS-1; i++)
{
CurrentMap = g_MapNames[i]
if(!CurrentMap[0])
break
formatex(Temp, 33, "%s^n", CurrentMap)
fputs(File, Temp)
// ?? fprintf
}
fclose(File)
}
}
public lastmapsCmd(id)
{
new LastMaps[256], n
n += formatex(LastMaps[n], 255-n, "Last maps played are :")
for(new i; i<MAX_MAPS; i++)
{
if(!g_MapNames[i][0])
break
n += formatex(LastMaps[n], 255-n, "^n%s", g_MapNames[i])
}
client_print(id, print_console, LastMaps)
return PLUGIN_HANDLED
}
public lastmapsSayCmd(id)
{
new LastMaps[192]
new n = formatex(LastMaps[n], 191-n, "Last maps played are :")
for(new i; i<MAX_MAPS; i++)
{
if(!g_MapNames[i][0])
{
n += formatex(LastMaps[n-1], 191-n+1, ".")
break
}
n += formatex(LastMaps[n], 191-n, " %s%s", g_MapNames[i], i+1 == MAX_MAPS ? "." : ",")
}
client_print(id, print_chat, LastMaps)
return PLUGIN_CONTINUE
}
__________________