/* 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; }