Nokia Posted January 24, 2012 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 150 Reputation: 5 Joined: 12/28/11 Last Seen: May 10, 2013 Share Posted January 24, 2012 Is there an NPC for Ingame News? im sure i saw one but i cant find it.. should be just an npc with message dialogs, the message can be write by any gm, maybe with an chatwindow over the npc or just an dialog. Quote Link to comment Share on other sites More sharing options...
ngek202 Posted January 24, 2012 Group: Members Topic Count: 40 Topics Per Day: 0.01 Content Count: 530 Reputation: 33 Joined: 01/17/12 Last Seen: August 16, 2017 Share Posted January 24, 2012 (edited) here I'll share what I was using on my Old Server, /* ================================================================ ,--. ,--. ,--. ,--. | | `--' ,---. ,--,--, | ,---. ,---. ,--,--.,--.--.,-' '-. | | ,--.| .-. || | .-. || .-. :' ,-. || .--''-. .-' | '--.| |' '-' '| || || | | | --. '-' || | | | `-----'`--' `---' `--''--'`--' `--' `----' `--`--'`--' `--' =========================== News Board ============================ - Current Version: 1.2.1: - Fixed a small mistake I made on the last update; 1.2:- Moved the configurations to the bottom of the script ( Line 200 to 215 ); - Fixed a bug when posting multiple news at a time; - Added an option to turn broadcasts on/off; 1.1: Optmized the script a LOT: - Removed many callsubs; - Optimized the SQL querys; - Corrected a mistake when deletings notices; - Added an option to print the news in descending order so you no longer need to run the SQL query to reorder the table; - Added an option to choose max number of printed news; - The "news" table will now be created when you @reloadscript or restart the server; - Added scape_sql so the script won't error when you use the string ' in your news; 1.0: First, unoptimized script. - Description: Easily post and read news in-game. =================================================================== */ prontera,163,180,1 script News Board 837,{ P_STAFF: if ( getgmlevel() >= .gmacess ) { mes "[News Board]"; mes "What would you like to do?"; switch ( select ("Read Board:Post New Notice:Delete Post") ) { case 1: next; callsub P_PLAYER; end; case 2: //Post new next; mes "[News Board]"; mes "What kind of news?"; switch ( select("Announcements:Events:Others" ) ) { case 1: set @type,1; break; case 2: set @type,2; break; case 3: set @type,3; break; } next; mes "[News Board]"; mes "Enter the title:"; input @title$; next; mes "[News Board]"; mes "Enter message:"; input @mes$[0]; if ( select ("I'm done:Add more") == 1 ) callsub POST_END; mes "- Enter second part of notice"; input @mes$[1]; if ( select ("I'm done:Add third part") == 1 ) callsub POST_END; mes "- Enter third part of notice"; input @mes$[2]; if ( select ("I'm done:Add fourth part") == 1 ) callsub POST_END; mes "- Enter fourth part of notice"; input @mes$[3]; if ( select ("I'm done:Add last part") == 1 ) callsub POST_END; mes "- Enter last part of notice"; input @mes$[4]; POST_END: next; mes "[News Board]"; mes "Here's a preview:"; next; set .@poster$,strcharinfo(0); set .@dateposted$,gettimestr("%Y-%m/%d %H:%M:%S",21); mes "[^FF0000" + @title$ + "^000000]"; mes "Posted by ^0033FF" + .@poster$ + "^000000"; mes "On ^0033FF" + .@dateposted$ + "^000000"; mes @mes$[0] + " " + @mes$[1] + " " + @mes$[2]+" " + @mes$[3] +" " + @mes$[4]; next; mes "[News Board]"; mes "Confirm?"; if (select("Yes:No") == 2) { next; callsub P_STAFF; } next; set .@ptitle$, escape_sql(@title$); set .@pmes$[0], escape_sql(@mes$[0]); set .@pmes$[1], escape_sql(@mes$[1]); set .@pmes$[2], escape_sql(@mes$[2]); set .@pmes$[3], escape_sql(@mes$[3]); set .@pmes$[4], escape_sql(@mes$[4]); query_sql("INSERT INTO `news` (`poster`,`title`,`content`,`content2`,`content3`,`content4`,`content5`,`type`,`date`) VALUES ('" + .@poster$ + "','" + .@ptitle$ + "','" + .@pmes$[0] + "','" + .@pmes$[1] + "','" + .@pmes$[2] + "','" + .@pmes$[3] + "','" + .@pmes$[4] + "','" + @type + "','" + .@dateposted$ + "')"); mes "[News Board]"; mes "New notice posted."; if (.broadcast) { if ( @type == 1 ) announce .@poster$ + " placed a new Announcement. Check the News Board!",bc_all; if ( @type == 2 ) announce .@poster$ + " placed a new Event. Check the News Board!",bc_all; if ( @type == 3 ) announce .@poster$ + " placed a new Notice. Check the News Board!",bc_all; } deletearray @mes$[0],10; close; case 3: //Delete next; mes "[News Board]"; mes "Input the post ID:"; input @did; query_sql "SELECT `poster`,`title`,`content`,`content2`,`content3`,`content4`,`content5`,`date` FROM `news` WHERE `id`='" + @did + "'",.@dposter$,.@dtitle$,.@dcontent$,.@dcontent2$,.@dcontent3$,.@dcontent4$,.@dcontent5$,.@ddate$; next; if ( .@dtitle$ == "") { mes "[News Board]"; mes "This post doesn't exist!"; close; } mes "Post ID ^FF0000" + @did + "^000000 is:"; mes "------------------------------"; mes "[^FF0000"+.@dtitle$+"^000000]"; mes "Posted by ^0033FF"+.@dposter$+"^000000"; mes "Date: ^0033FF"+.@ddate$+"^000000"; mes .@dcontent$ + " " + .@dcontent2$ + " " + .@dcontent3$ + " " + .@dcontent4$ + " " + .@dcontent5$; mes "------------------------------"; next; mes "[News Board]"; mes "Confirm?"; if (select("Yes:No") == 2) { next; callsub P_STAFF; } query_sql "DELETE FROM `news` WHERE `id`='" + @did + "'"; next; mes "[News Board]"; mes "Post deleted."; close; } } P_PLAYER: mes "[News Board]"; mes "Wich news do you want to read?"; switch ( select ("Announcements:Events:Others") ) { case 1: set @type,1; break; case 2: set @type,2; break; case 3: set @type,3; break; } next; if ( .pdesc ) { query_sql "SELECT `id`,`poster`,`title`,`content`,`content2`,`content3`,`content4`,`content5`,`date` FROM `news` WHERE `type`='" + @type + "' ORDER BY `id` DESC LIMIT " + .nlimit,.@pid,.@pposter$,.@ptitle$,.@pcontent$,.@pcontent2$,.@pcontent3$,.@pcontent4$,.@pcontent5$,.@pdate$; } else { query_sql "SELECT `id`,`poster`,`title`,`content`,`content2`,`content3`,`content4`,`content5`,`date` FROM `news` WHERE `type`='" + @type + "' LIMIT " + .nlimit,.@pid,.@pposter$,.@ptitle$,.@pcontent$,.@pcontent2$,.@pcontent3$,.@pcontent4$,.@pcontent5$,.@pdate$; } if (!.@pid) { mes "[News Board]"; mes "This section is empty."; close; } for( set .@n, 0; .@n < getarraysize( .@pid ); set .@n, .@n +1 ) { mes "[^FF0000" + .@ptitle$[.@n] + "^000000]"; mes "Posted by ^0033FF" + .@pposter$[.@n] + "^000000"; mes "Date: ^0033FF" + .@pdate$[.@n] + "^000000"; mes .@pcontent$[.@n] + " " + .@pcontent2$[.@n] + " " + .@pcontent3$[.@n] + " " + .@pcontent4$[.@n] + " " + .@pcontent5$[.@n]; if ( getgmlevel() >= .gmacess ) {mes "ID of this post: ^FF0000"+.@pid[.@n]+"^000000";} mes "=============================="; } next; if ( getgmlevel() >= .gmacess ) goto P_STAFF; else goto P_PLAYER; end; OnInit: /* ==================== Configurations ==================== */ // GMs with this lvl will be able to post/delete news. // They also will be able to see the post ID. set .gmacess,99; // Do you want to print the news in descending order (Newer to older)? 1 = yes, 0 = no set .pdesc,1; // Maximum number of news you want to display ( up to 128 ) set .nlimit,50; // Broadcast when news are posted? 1 = yes, 0 = no set .broadcast,1; /* ======================================================== */ waitingroom "NEWS Board",0; query_sql("CREATE TABLE IF NOT EXISTS `news` (`id` INT(11) NOT NULL auto_increment,`poster` VARCHAR(20) NOT NULL,`title` VARCHAR(20) NOT NULL,`content` VARCHAR(100) NOT NULL,`content2` VARCHAR(100) NOT NULL,`content3` VARCHAR(100) NOT NULL,`content4` VARCHAR(100) NOT NULL,`content5` VARCHAR(100) NOT NULL,`type` INT(11) NOT NULL,`date` DATE NOT NULL, PRIMARY KEY(`id`)) ENGINE=MyISAM"); end; } but i think you need to make an entry on the SQL too, though I'm not good with maybe you could ask some dev's here Edited January 24, 2012 by Arcenciel Codeboxed Quote Link to comment Share on other sites More sharing options...
Jb Roxas Posted January 29, 2012 Group: Members Topic Count: 40 Topics Per Day: 0.01 Content Count: 95 Reputation: 0 Joined: 01/28/12 Last Seen: August 21, 2012 Share Posted January 29, 2012 sir its not working, i cant see the npc board, can u refixed please? Quote Link to comment Share on other sites More sharing options...
Reducto Posted January 29, 2012 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 231 Reputation: 9 Joined: 12/16/11 Last Seen: August 10, 2016 Share Posted January 29, 2012 I've tested it, it's working fine with me. Quote Link to comment Share on other sites More sharing options...
mrlongshen Posted January 27, 2013 Group: Members Topic Count: 98 Topics Per Day: 0.02 Content Count: 1302 Reputation: 79 Joined: 12/04/12 Last Seen: September 26, 2019 Share Posted January 27, 2013 thx its working xD Quote Link to comment Share on other sites More sharing options...
Question
Nokia
Is there an NPC for Ingame News? im sure i saw one but i cant find it..
should be just an npc with message dialogs, the message can be write by any gm, maybe with an chatwindow over the npc or just an dialog.
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.