viewing paste Unknown #19405 | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
/*
    Broadcaster script (C) Oxxy, 2015, v1.0
        *Can log messages, that are send by players
        *Either zeny and items can be used to pay.
        *Automatically create table broadcast_log where everything is logged if logging turned on.
        *Check if WOE is on, turn off NPC if so (if .checkWOE = 1)
        
        GM Menu:
        *NPC can be turned on/off
        *Logging can be turned on/off (default: on)
        *Warning message can be turned on/off (default: off)
    
    v1.0 Initial release
*/
celestiaj,60,68,5   script  Broadcaster 935,{
    OnUse:
    if(getgroupid() >= .grpID) {
        GMMenu:
        if(getgroupid() < .grpID) end;
        mes .npc$;
        mes "Чем я могу Вам помочь?";
        switch(select(""+((!.enableNPC)?"^00FF00Включить^000000":"^FF0000Выключить^000000")+" отправление сообщений:"+((!.log)?"^00FF00Включить^000000":"^FF0000Выключить^000000")+" логирование сообщений:"+((!.warning)?"^00FF00Включить^000000":"^FF0000Выключить^000000")+" предупреждение:Забанить последнего пользователя:Меню игрока")) {
        
            case 1:
            next;
            mes .npc$;
            mes "Отправление сообщений "+( (!.enableNPC)?"^FF0000отключено^000000":"^00FF00включено^000000")+".";
            mes ""+( (!.enableNPC)?"^00FF00Включить^000000":"^FF0000Выключить^000000")+"?";
            if(select("Да:Нет")==2 ) close;
            if(!.enableNPC) .enableNPC = 1;
            else .enableNPC = 0;
            next;
            mes .npc$;
            mes "Отправление сообщений "+( (!.enableNPC)?"^FF0000отключено^000000":"^00FF00включено^000000")+".";
            next;
            goto GMMenu;
 
            case 2:
            next;
            mes .npc$;
            mes "Логирование сообщений теперь "+( (!.log)?"^FF0000выключено^000000":"^00FF00включено^000000")+".";
            mes ""+( (!.log)?"^00FF00Включить^000000":"^FF0000Выключить^000000")+"?";
            if(select("Да:Нет")==2 ) close;
            if(!.log) .log = 1;
            else .log = 0;
            next;
            mes .npc$;
            mes "Логирование сообщений теперь "+( (!.log)?"^FF0000выключено^000000":"^00FF00включено^000000")+".";
            next;
            goto GMMenu;
            
            case 3:
            next;
            mes .npc$;
            mes "Предупреждение перед отправкой сообщения "+( (!.warning)?"^FF0000выключено^000000":"^00FF00включено^000000")+".";
            mes ""+( (!.warning)?"^00FF00Включить^000000":"^FF0000Выключить^000000")+"?";
            if(select("Да:Нет")==2 ) close;
            if(!.warning) .warning = 1;
            else .warning = 0;
            next;
            mes .npc$;
            mes "Предупреждение "+( (!.warning)?"^FF0000выключено^000000":"^00FF00включено^000000")+".";
            next;
            goto GMMenu;
            
            case 4:
            next;   
            mes .npc$;
            if(.lastname$ == "") {
                mes "Меня еще никто не использовал, хотите вернуться обратно?";
                if(select("Да:Нет") == 2) close;
                next;
                goto GMMenu;
            }
            mes "Последний игрок, использовавший меня: ^FF0000"+.lastname$+"^000000.";
            next;
            mes .npc$;
            mes "Забанить этого игрока?";
            if(select("Да:Нет")==2) close;
            atcommand "@ban 15n " + .lastname$;
            announce "[Диктор]: Игрок ["+.lastname$+"] был забанен за нецелесообразное пользование моими услугами.",0;
            next;
            mes .npc$;
            mes "Игрок забанен.";
            next;
            goto GMMenu;
 
            case 5:
            next;
            goto PlayersMenu;
        }
 
    }
 
    PlayersMenu:
    if(.enableNPC == 0){
        mes .npc$;
        mes "Извините, этот НПЦ выключен на данный момент.";
        next;
        mes .npc$;
        mes "Пожалуйста, сообщите об этом администрации или задайте вопрос через ^0000FF@faq^000000";
        close;
    }
 
    if(.checkWOE && (agitcheck() == 1) || (agitcheck2() == 1)) {
        mes .npc$;
        mes "Извините, Вы не можете отправлять сообщения пока идёт ^0000FFWoE^000000.";
        close;
    }
 
    if(BD > gettimetick(2)) {
        mes .npc$;
        mes "Вы должны подождать ^FF0000180^000000 секунд, преждем чем отправлять еще одно сообщение.";
        close;
    }
 
    if (BaseLevel < .baseLevelRequired) {
        mes .npc$;
        mes "Вы должны быть не менее ^0000FF"+.baseLevelRequired+"^000000 уровня чтобы пользоваться моими услугами.";
        close;
    }
 
    mes .npc$;
    mes "Здраствуйте, "+strcharinfo(0)+"! Я могу отправлять сообщения на весь сервер.";
    if(.warning) {
        next;
        mes .npc$;
        mes "Прежде чем начать...";
        next;
        mes .npc$;
        mes "Используя меня вы автоматически соглашаетесь со всеми правилами сервера.";
        next;
        if (.log) {
            mes .npc$;
            mes "Также, ваш никнейм, сообщение и дата ^FF0000логируются^000000.";
            next;
        }
        mes .npc$;
        mes "Вы согласны?";
        if(select("Да:Нет")==2) close;
    }
 
    if(!.Price && (.itemUsed[0] == 0 || .@itemUsed[1] == 0)) goto Message;
    next;
    mes .npc$;
    mes "Мне нужно взять с Вас определённую плату за пользование моими услугами";
    mes "Чем Вы хотите оплатить мои услуги?";
    switch(select("> Zeny:> Вещами:")) {
        case 1:
        ZenyPay:
        if(!.Price) goto ItemsPay;
        next;
        mes .npc$;
        mes "Это будет стоить Вам ^FF0000"+.Price+"^000000 Zeny.";
        mes "Продолжить?";
        if(select("Да:Нет")==2) close;
        if (Zeny < .Price) {
            next;
            mes .npc$;
            mes "У Вас не хватает ^FF0000"+(.Price-Zeny)+" Zeny^000000.";
            close;
        }
        Zeny -= .Price;
        goto Message;
        
        case 2:
        ItemsPay:
        if(!.itemUsed[0] || !.itemUsed[1]) goto ZenyPay;
        next;
        mes .npc$;
        mes "Мне понадобится ^0000FF"+.itemUsed[1]+"^000000х ^FF0000"+getitemname(.itemUsed[0])+"^000000.";
        mes "Продолжить?";
        if(select("Да:Нет")==2) close;
        if(countitem(.itemUsed[0]) < .itemUsed[1]) {
            next;
            mes .npc$;
            mes "У Вас не хватает ^FF0000"+getitemname(.itemUsed[0])+"^000000.";
            close;
        }
        delitem .itemUsed[0], .itemUsed[1];
        goto Message;
    }
 
    Message:
    next;
    mes .npc$;
    mes "Пожалуйста, введите своё сообщение сюда: ";
    input .@mes$;
    next;
    mes .npc$;
    mes "Вы уверены, что хотите отправить это сообщение всем?";
    mes "^FF0000["+strcharinfo(0)+"]: "+.@mes$+"^000000";
    if(select("Да:Нет") == 2) goto Message;
    close2;
    announce "["+strcharinfo(0)+"]: "+.@mes$,bc_all;
    .lastname$ = strcharinfo(0);
    if(.log) query_sql("INSERT INTO `broadcast_log` (`char_id`,`name`,`message`,`date`) VALUES ('"+getcharid(0)+"','"+strcharinfo(0)+"','"+.@mes$+"',NOW())");
    if(.timedelay[0] == 1) BD = gettimetick(2) + .timedelay[1];
    end;
 
    OnInit:
        .npc$ = "[^0000FFДиктор^000000]"; // NPC Header
        .baseLevelRequired = 89;                    // Minimum Base Level to use Broadcaster NPC
        .grpID = 40;                        // Minimum group ID to use GM menu
        .Price = 0;                     // Zeny cost to send message.
        
        setarray .itemUsed[0], 7539, 0; // .itemUsed[0] == item id
                                            // .itemUsed[1] == item amount
                                            // if one of this values set to 0, the npc will only allow you to pay with zeny.
                                            
        setarray .timedelay[0], 0, 180;     // Turn on delay?
                                            // if .timedelay[0] == 0 -> delay is off.
                                            // if .timedelay[0] == 1 -> delay is o
                                            // .timedelay[1] -> delay in seconds. 180 = 3 mins.
                                            
        .checkWOE = 0;                      // Disable the usage of NPC if WOE is on? 1 = true, 0 = false;                                  
        .enableNPC = 1;                     // NPC is enabled? (1 = enabled, 0 = disabled)
        .log = 1;                           // Message logging (1 = enabled, 0 = disabled)
        .warning = 0;                       // Show warning while using NPC? (warning about logging and usage of NPC)
        query_sql ("CREATE TABLE IF NOT EXISTS `broadcast_log` ( `char_id` bigint(20) unsigned NOT NULL, `name` longtext COLLATE utf8_unicode_ci NOT NULL, `message` longtext COLLATE utf8_unicode_ci NOT NULL, `date` varchar(30) NOT NULL, PRIMARY KEY  (`char_id`))");
        end;
}
Viewed 614 times, submitted by Guest.