/* * _______ _ _ __ __ * | _____/ | | | | \ \ __ / / * | | | | | | | | / \ | | * | | | |____| | | |/ __ \| | * | | ___ | ______ | | / \ | * | | |_ | | | | | | / \ | * | | | | | | | | | | | | * | |____| | | | | | | | | | * |_______/ |_| |_| \_/ \_/ * * * * Last Edited: 01-05-08 * * ============ * Changelog: * ============ * * v1.0 * -Initial Release * */ #define VERSION "1.0" #include #include new configfile[200] new logfile[200] public plugin_init() { register_plugin("GHW Say Commands",VERSION,"GHW_Chronic") register_cvar("say_commands_toggle","1") register_concmd("amx_say_commands_toggle","cmd_toggle",ADMIN_LEVEL_C,"<1/on 0/off> Toggle the custom Say Commands off/on") register_clcmd("say","hook_say") register_clcmd("say_team","hook_say") register_clcmd("client_commands","list_commands") new configsdir[200] get_configsdir(configsdir,199) format(configfile,199,"%s/say_commands.ini",configsdir) format(logfile,199,"%s/say_commands_log.log",configsdir) } public client_putinserver(id) { set_task(62.8,"advertise",id) } public client_disconnect(id) { remove_task(id) } public advertise(id) { if(get_cvar_num("say_commands_toggle")) { client_print(id,print_chat,"[AMX] Type /rules to view server rules.") client_print(id,print_chat,"[AMX] Type /cmds to view server commands.") } set_task(260.6,"advertise",id) return PLUGIN_HANDLED } public cmd_toggle(id,level,cid) { if(!cmd_access(id,level,cid,2)) { return PLUGIN_HANDLED } new arg1[32] read_argv(1,arg1,31) if(get_cvar_num("say_commands_toggle")) { if(equali(arg1,"on") || equali(arg1,"1")) { console_print(id,"Custom Say Commands Plugin is already toggled on.") } else { console_print(id,"Custom Say Commands Plugin has been toggled off.") set_cvar_num("say_commands_toggle",0) } } else if(!get_cvar_num("say_commands_toggle")) { if(equali(arg1,"on") || equali(arg1,"1")) { console_print(id,"Custom Say Commands Plugin has been toggled on.") set_cvar_num("say_commands_toggle",1) } else { console_print(id,"Custom Say Commands Plugin is already toggled off.") } } return PLUGIN_HANDLED } public hook_say(id) { if(!get_cvar_num("say_commands_toggle") || !file_exists(configfile)) { return PLUGIN_CONTINUE } for(new i=0;i<=file_size(configfile,1) - 1;i++) { new read[32] new trash read_file(configfile,i,read,31,trash) if(containi(read,"]")==0) { new text[200] read_args(text,199) remove_quotes(text) replace(read,31,"]","") new read2[32] read_file(configfile,i+1,read2,31,trash) new bool:continuea=false if(equali(read2,"exact") && containi(text,read)==0) { continuea=true } if(equali(read2,"contain") && containi(text,read)!=-1) { continuea=true } if(continuea) { new read3[32] read_file(configfile,i+2,read3,31,trash) new show = PLUGIN_CONTINUE if(equali(read3,"don't show")) { show = PLUGIN_HANDLED } new read4[32] read_file(configfile,i+3,read4,31,trash) if(equali(read4,"MOTD")) { new read5[200] read_file(configfile,i+4,read5,199,trash) new name[32] get_user_name(id,name,31) new hostname[32] get_cvar_string("hostname",hostname,31) new ip[32] get_user_ip(0,ip,31,0) new ping1, loss1, ping[8], loss[8] get_user_ping(id,ping1,loss1) format(ping,7,"%d",ping1) format(loss,7,"%d",loss1) new date[32] format_time(date,31,"%m-%d-%Y",-1) new time[32] format_time(time,31,"%H:%M",-1) new map[32] get_mapname(map,31) new frags1 = get_user_frags(id) new deaths1 = get_user_deaths(id) new frags[8], deaths[8] format(frags,7,"%d",frags1) format(deaths,7,"%d",deaths1) new authid[32] get_user_authid(id,authid,31) new team[32] get_user_team(id,team,31) while(contain(read5,"%name")!=-1) { replace(read5,199,"%name",name) } while(contain(read5,"%hostname")!=-1) { replace(read5,199,"%hostname",hostname) } while(contain(read5,"%ip")!=-1) { replace(read5,199,"%ip",ip) } while(contain(read5,"%ping")!=-1) { replace(read5,199,"%ping",ping) } while(contain(read5,"%loss")!=-1) { replace(read5,199,"%loss",loss) } while(contain(read5,"%date")!=-1) { replace(read5,199,"%date",date) } while(contain(read5,"%time")!=-1) { replace(read5,199,"%time",time) } while(contain(read5,"%map")!=-1) { replace(read5,199,"%map",map) } while(contain(read5,"%frags")!=-1) { replace(read5,199,"%frags",frags) } while(contain(read5,"%deaths")!=-1) { replace(read5,199,"%deaths",deaths) } while(contain(read5,"%authid")!=-1) { replace(read5,199,"%authid",authid) } while(contain(read5,"%team")!=-1) { replace(read5,199,"%team",team) } while(contain(text,read)!=-1) { replace(text,199,read,"") } while(contain(read5,"%text")!=-1) { replace(read5,199,"%text",text) } if(containi(read5,"HTTP://")==0) { new motdtext[500] format(motdtext,499,"