Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- new Motd[2][101][50];
- new folder[101], file[101];
- public plugin_init() {
- register_plugin("Motd Manager", "3.0", "DecaK")
- register_clcmd("say", "say_hook")
- register_clcmd("say_team", "say_hook")
- ucitajpodatke();
- }
- public plugin_precache() {
- new config[101];
- get_configsdir(config, charsmax(config))
- formatex(folder, charsmax(folder), "%s/motds/", config)
- formatex(file, charsmax(file), "%s/advertisements-motd.ini", config)
- formatex(config, charsmax(config), "%s/motds/default.txt", config)
- if(!dir_exists(folder))
- mkdir(folder)
- if(!file_exists(file)) {
- write_file(file, ";You can type a command and motd in this file")
- write_file(file, "^"/hosting^" ^"hosting.txt^"")
- }
- if(!file_exists(config))
- write_file(config, "GOLD Hosting Plug-in made by DecaK")
- }
- public say_hook(id) {
- new sayed[192];
- read_args(sayed, charsmax(sayed));
- for(new i=0;i<sizeof Motd[];i++) {
- if(containi(sayed, Motd[0][i]) != -1) {
- new motd[150];
- formatex(motd, charsmax(motd), "%s%s", folder, Motd[1][i])
- show_motd(id, motd)
- return PLUGIN_HANDLED;
- }
- }
- return PLUGIN_CONTINUE;
- }
- ucitajpodatke() {
- new line[101];
- formatex(line, charsmax(line), file)
- new f = fopen(line, "rt");
- if(!f) {
- write_file(line, "")
- return PLUGIN_HANDLED;
- }
- new i = 0;
- while(!feof(f)) {
- fgets(f, line, charsmax(line))
- if(line[0] == ';') continue;
- new motd[50], lokacija[50];
- parse(line, motd, charsmax(motd), lokacija, charsmax(lokacija))
- formatex(Motd[0][i], sizeof Motd[][], motd)
- formatex(Motd[1][i], sizeof Motd[][], lokacija)
- i++
- }
- fclose(f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement