/* * MOTD Maker - for mods lacking MOTD functionality - such as MS:C * * Adapted from [TeamHoward]Papasmurf's Rules.txt for NS (www.modns.org) * * Displays contents of MOTD.TXT on client's HUD and Console 20 seconds post connect. * Credit scrolling effect for niftiness. * Intended to eliminate need for repeating flashy amx_imessage/scrollers. * * Beware: Having a huge MOTD.txt may crash the client. * * Client Console Commands: mscmotd - displays MOTD to client when activated * motd in chat also displays MOTD to client * * Registered Cvars [defaults]: * motd_displaytime[15.0] amount of time message stays on screen * motd_red[255.0] motd_green[0.0],motd_blue[0.0] - color mix of message text * * Changelog: * 1.2 - Added chat activation by typing 'motd' in chat * 1.1 - Changed vars from mp_ to motd_ * * No warranties, distribute freely. */ #include #include public plugin_init() { register_plugin("MOTD","1.2","[TeamHoward]PapaSmurf") register_cvar("motd_displaytime","15.0",4) register_cvar("motd_red","255.0",4) register_cvar("motd_green","0.0",4) register_cvar("motd_blue","0.0",4) register_clcmd("mscmotd","rules") register_clcmd("say_text","saymotd") } public client_connect(id) { set_task(20.0,"rules",id,"",0,"",0) } public rules(id) { new line[80], len, Lines = 0 new rulesTable[1280] new Float:displaytime = get_cvar_float("motd_displaytime") new red = get_cvar_num("motd_red") new green = get_cvar_num("motd_green") new blue = get_cvar_num("motd_blue") while (read_file("motd.txt", Lines++, line, 79, len)) { //thanks CheesyPeteza! format(line, 79,"%s^n",line) add(rulesTable,1279,line) client_print(id, print_console, "%s^n", line) } //thanks again CheesyPeteza! set_hudmessage(red,green,blue, 0.028, 0.125, 2, 0.02,displaytime, 0.01, 0.1, 4) show_hudmessage(id,rulesTable) return PLUGIN_HANDLED } //thothie public saymotd(id,level,cid) { //read in command new saytext[64]; read_args(saytext,63); if ( contain(saytext,"motd") > -1 ) { rules(id); } }