From adb39b9ab18ceeddb5cd3cd64ae9c4a8050975a5 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Tue, 17 Feb 2004 17:17:10 +0000 Subject: [PATCH] replaces the default motd window --- plugins/welcomemsg.sma | 83 ++++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 35 deletions(-) diff --git a/plugins/welcomemsg.sma b/plugins/welcomemsg.sma index c563b68b..2363284e 100755 --- a/plugins/welcomemsg.sma +++ b/plugins/welcomemsg.sma @@ -9,6 +9,8 @@ #include #include +#define MOTD_LENGTH 1024 + // Settings (comment unwanted options) #define SHOW_MODS #define READ_FROM_FILE @@ -29,10 +31,20 @@ public plugin_init() #endif } -new g_Bar[] = "==============" +public plugin_cfg() +{ + set_cvar_string("motdfile","") +} -public client_connect(id) { - new name[32], hostname[64], nextmap[32], mapname[32] +public client_putinserver(id) { + new param[1] + param[0] = id + set_task(2.5,"alt_motd",0,param,1) +} + +public alt_motd(param[]) { + new id = param[0] + new motdBody[MOTD_LENGTH], name[32], hostname[64], nextmap[32], mapname[32] get_cvar_string("hostname",hostname,63) get_user_name(id,name,31) @@ -40,83 +52,84 @@ public client_connect(id) { get_mapname(mapname,31) get_cvar_string("amx_nextmap",nextmap,31) - client_cmd(id, "echo ;echo %s%s%s%s",g_Bar,g_Bar,g_Bar,g_Bar) - client_cmd(id, "echo ^" Hello %s, welcome to %s^"",name,hostname) + new len = copy(motdBody,MOTD_LENGTH,"") + len += format(motdBody[len],MOTD_LENGTH-len,"Hello %s, welcome to %s
    ",name,hostname) #if defined SHOW_TIME_AND_IP new stime[64],ip[32] get_time("%A %B %d, %Y - %H:%M:%S",stime,63) get_user_ip(id,ip,31) - client_cmd(id, "echo ^" Today is %s^"",stime) - client_cmd(id, "echo ^" You are playing from: %s^"",ip) + len += format(motdBody[len],MOTD_LENGTH-len,"
  • Today is %s
  • ",stime) + len += format(motdBody[len],MOTD_LENGTH-len,"
  • You are playing from: %s
  • ",ip) #endif new maxplayers = get_cvar_num("sv_visiblemaxplayers") if ( maxplayers < 0 ) maxplayers = get_maxplayers() - client_cmd(id, "echo ^" Players on server: %d/%d^"",get_playersnum(),maxplayers) - client_cmd(id, "echo ^" Current map: %s, Next map: %s^"",mapname,nextmap) + len += format(motdBody[len],MOTD_LENGTH-len,"
  • Players on server: %d/%d
  • ",get_playersnum(),maxplayers) + len += format(motdBody[len],MOTD_LENGTH-len,"
  • Current map: %s, Next map: %s
  • ",mapname,nextmap) // Time limit and time remaining new Float:mp_timelimit = get_cvar_float("mp_timelimit") if (mp_timelimit){ new timeleft = get_timeleft() if (timeleft > 0) - client_cmd(id, "echo ^" Time Left: %d:%02d of %.0f minutes^"", timeleft / 60, timeleft % 60, mp_timelimit ) + len += format(motdBody[len],MOTD_LENGTH-len,"
  • Time Left: %d:%02d of %.0f minutes
  • ",timeleft / 60, timeleft % 60, mp_timelimit) } else{ - client_cmd(id, "echo ^" No time limit^"") + len += copy(motdBody[len],MOTD_LENGTH-len,"
  • No time limit
  • ") } // C4 and FF if ( g_cstrikeRunning ){ - client_cmd(id, "echo ^" Friendly fire is %s^"", get_cvar_float("mp_friendlyfire") ? "ON" : "OFF") - client_cmd(id, "echo ^" C4 timer is set to %.0f sec.^"",get_cvar_float("mp_c4timer")) + len += format(motdBody[len],MOTD_LENGTH-len,"
  • Friendly fire is %s
  • ",get_cvar_num("mp_friendlyfire") ? "ON" : "OFF") + len += format(motdBody[len],MOTD_LENGTH-len,"
  • C4 timer is set to %.0f sec.
  • ",get_cvar_float("mp_c4timer")) } + len += copy(motdBody[len],MOTD_LENGTH-len,"
") // Server Mods #if defined SHOW_MODS new mod_ver[32] - client_cmd(id, "echo ;echo ^" Server mods:^"") + len += copy(motdBody[len],MOTD_LENGTH-len,"
Server mods:
    ") get_cvar_string("amx_version",mod_ver,31) - if (mod_ver[0]) client_cmd(id, "echo ^" o AMX Mod %s^"",mod_ver) + if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"
  • AMX Mod %s
  • ",mod_ver) get_cvar_string("statsme_version",mod_ver,31) - if (mod_ver[0]) client_cmd(id, "echo ^" o StatsMe %s^"",mod_ver) + if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"
  • StatsMe %s
  • ",mod_ver) get_cvar_string("clanmod_version",mod_ver,31) - if (mod_ver[0]) client_cmd(id, "echo ^" o ClanMod %s^"",mod_ver) + if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"
  • ClanMod %s
  • ",mod_ver) get_cvar_string("admin_mod_version",mod_ver,31) - if (mod_ver[0]) client_cmd(id, "echo ^" o AdminMod %s^"",mod_ver) + if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"
  • AdminMod %s
  • ",mod_ver) get_cvar_string("chicken_version",mod_ver,31) - if (mod_ver[0]) client_cmd(id, "echo ^" o Chicken %s^"",mod_ver) + if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"
  • Chicken %s
  • ",mod_ver) get_cvar_string("csguard_version",mod_ver,31) - if (mod_ver[0]) client_cmd(id, "echo ^" o CSGuard %s^"",mod_ver) + if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"
  • CSGuard %s
  • ",mod_ver) get_cvar_string("hlguard_version",mod_ver,31) - if (mod_ver[0]) client_cmd(id, "echo ^" o HLGuard %s^"",mod_ver) + if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"
  • HLGuard %s
  • ",mod_ver) get_cvar_string("plbot_version",mod_ver,31) - if (mod_ver[0]) client_cmd(id, "echo ^" o PLBot %s^"",mod_ver) + if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"
  • PLBot %s
  • ",mod_ver) get_cvar_string("booster_version",mod_ver,31) - if (mod_ver[0]) client_cmd(id, "echo ^" o HL-Booster %s^"",mod_ver) + if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"
  • HL-Booster %s
  • ",mod_ver) get_cvar_string("axn_version",mod_ver,31) - if (mod_ver[0]) client_cmd(id, "echo ^" o AXN %s^"",mod_ver) + if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"
  • AXN %s
  • ",mod_ver) get_cvar_string("bmx_version",mod_ver,31) - if (mod_ver[0]) client_cmd(id, "echo ^" o BMX %s^"",mod_ver) + if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"
  • BMX %s
  • ",mod_ver) get_cvar_string("cdversion",mod_ver,31) - if (mod_ver[0]) client_cmd(id, "echo ^" o Cheating-Death %s in %s Mode^"", + if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"
  • Cheating-Death %s in %s Mode
  • ", mod_ver, get_cvar_num("cdrequired") ? "Required" : "Optional" ) get_cvar_string("atac_version",mod_ver,31) - if (mod_ver[0]) client_cmd(id, "echo ^" o ATAC %s%s^"" , mod_ver , get_cvar_num("atac_status") - ? " (setinfo atac_status_off 1 disables Live Status)" : "" ) - + if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"
  • ATAC %s
  • ",mod_ver) + len += copy(motdBody[len],MOTD_LENGTH-len,"
") #endif // Info. from custom file #if defined READ_FROM_FILE if (file_exists(g_motdFile)) { - new message[192], len, line = 0 - client_cmd(id, "echo %s%s%s%s",g_Bar,g_Bar,g_Bar,g_Bar) - while(read_file(g_motdFile,line++,message,191,len)) - client_cmd(id,"echo ^"%s^"",message) + new message[192], len2, line = 0 + len += format(motdBody[len],MOTD_LENGTH-len,"
") + while(read_file(g_motdFile,line++,message,191,len2)) + len += copy(motdBody[len],MOTD_LENGTH-len,message) } #endif - - client_cmd(id, "echo %s%s%s%s",g_Bar,g_Bar,g_Bar,g_Bar) + len += copy(motdBody[len],MOTD_LENGTH-len,"") + show_motd(id,motdBody) } \ No newline at end of file