Change demo name here
PHP Code:
new const g_szDemoName[] = "yourdemoname"
The Plugin:
PHP Code:
#include <amxmodx>
#define NAME "Auto recording demo"
#define VERSION "1.0"
#define AUTHOR "AlliedMods"
new g_DemoEnable, g_DemoRdelay;
new const g_szDemoName[] = "yourdemoname"
public plugin_init()
{
register_plugin( NAME, VERSION, AUTHOR )
g_DemoEnable = register_cvar("amx_demo_enable", "1")
g_DemoRdelay = register_cvar("amx_demo_record_delay", "8")
}
public client_putinserver(id)
{
if(get_pcvar_num(g_DemoEnable))
{
set_task(get_pcvar_float(g_DemoRdelay), "task_record", id);
}
}
public task_record(id)
{
if( is_user_connected(id))
{
new Name[33], Time[9], Date[12]
get_user_name(id, Name, 32)
get_time("%H:%M:%S", Time, 8)
get_time("%d.%m.%Y", Date, 11)
client_cmd(id, "stop; record ^"%s^"", g_szDemoName)
ChatColor(id, "^3[^4AMXX^3]^1 Welcome to this Server, ^3%s^1!", Name)
ChatColor(id, "^3[^4AMXX^3]^1 The Server is recording ^"^3%s.dem^1^"", g_szDemoName)
ChatColor(id, "^3[^4AMXX^3]^1 Date: ^4%s^1 Time: ^4%s^1", Date, Time)
}
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!t", "^3")
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}