Author Topic: RBTTNews v1.1 [Pics][Final]  (Read 1286 times)

0 Members and 1 Guest are viewing this topic.

FakeTruth

  • Registered Forum Member
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
RBTTNews v1.1 [Pics][Final]
« on: June 12, 2009, 11:28:46 AM »
SOURCE: http://http://forums.epicgames.com/showthread.php?t=685489


Quote from: "FakeTruth"
Name: RBTTnews
Version: v1.1
Compatibility: 2.1
Description:
A mutator that presents players with news that is loaded from the internet. It can display multiple pages, but you need some kind of script that's on the web page to present the mutator the right news.
The mutator sends a request for URL?page=[pagenum] you can use PHP to parse what page should be shown then.
You can even make it read from RSS or WHATEVER! As long as you have some script behind it that parses it for the mutator

The mutator will look for some tags in the page it downloads:
Code: [Select]
<lastnews> If this tag is found, the 'Older' button is disabled
<page>[pagenum]</page> This is used to synch up with the page it downloaded
<title>[title]</title> Whatever is between these two tags is displayed above the news in bigger letters

To configure this mutator, you must open up UTRBTTNews.ini
Code: [Select]
[RBTTNews.MutNews]
;The server TargetFile is on
Server=www.rbthinktank.com
;The complete URL to the file you need to load
TargetFile=http://www.rbthinktank.com/RBUT3ServerNews/readnews.php

You can have news as big as you want (a scrollbar will pop up), AFAIK there's no limit, nor is there a limit to how many news articles/pages you have.

Here's a little PHP script to get you goin'
readnews.php
Code: [Select]
<?
//=================\\
//  READNEWS.PHP   \\
//=================\\
$newsfolder = "news/"; // Change this to where you put the news

if(!isset($_GET['page'])) // If it can't find the page variable
{
$page = 0; // Set page to 0
}
else
{
$page = $_GET['page']; // Set page to the requested page number
}

if ($handle = opendir($newsfolder)) { // Open a directory for reading
while (false !== ($file = readdir($handle))) { // Loop through all files
if($file!=".." AND $file!="." AND $file!=".htaccess"){ // Only add the files we need
$filelist[] = $file;
}
}
}

sort($filelist); // sort the array by their values (the filenames)
// can sort by date by using $uts=filemtime($file).md5($file);  
// filemtime(); grabs creation date

$newscount = Count($filelist)-1; // Get the array length

if($page > $newscount)
{
$page = $newscount; // Set page to highest newscount
// I do this, so we will not request pages that aren't there!
}

if($newscount == $page)
{
echo "<lastnews>"; // The mutator will parse the received page, and look for <lastnews> tags
// When this tag is found, the 'Older' button will be disabled
}
echo "<page>".$page."</page>"; // The mutator will also look for the page number, so it can be synched

// Use include, so we can also use PHP in the news files
include($newsfolder.$filelist[$newscount-$page]);
?>

Comments:
You MAY edit this mutator, but all I ask for is that you LEAVE the copyright intact AND the link to rbthinktank.com INTACT on the menu! That's ALL I ask for. If you do not go with these rules, we will flame you to death, so be warned :happy-cheerleadersmileygirl:
If you want this on, I'll give support wherever needed!
« Last Edit: June 14, 2009, 13:29:22 PM by FakeTruth »

ekay

  • Registered Forum Member
  • *
  • Posts: 373
  • Karma: +0/-0
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #1 on: June 12, 2009, 12:15:47 PM »
I'm sure Zeus will be very happy to see this :D

Zofo

  • Community Leaders
  • Registered Forum Member
  • ******
  • Posts: 3039
  • Karma: +41/-7
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #2 on: June 12, 2009, 13:29:16 PM »
Quote from: "ekay"
I'm sure Zeus will be very happy to see this :D


oh yes he does love to spam the news

Zeus

  • Community Leaders
  • Registered Forum Member
  • ******
  • Posts: 2067
  • Karma: +13/-2
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #3 on: June 12, 2009, 13:37:56 PM »
Was looking at this over at Epic and I think it would be a great.

Only problem is I have no idea how to use PHP script

but I suppose there must be an easy way to do it or I will have to learn.

Could be a great way for folk to get some info about us too, new maps, etc etc



Quote from: "Zofo"
Quote from: "ekay"
I'm sure Zeus will be very happy to see this :D


oh yes he does love to spam the news

Yes I will post when I have something to post about, not like others who just post  :violence-hammer:  :lol:

FakeTruth

  • Registered Forum Member
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #4 on: June 12, 2009, 14:25:42 PM »
I already provided a simple PHP script that looks for files in the 'news/' folder, and sort them alphabetically. So you can even use a date as a filename:

If you put 3 files in the 'news/' folder, they will be sorted like this:
2009-01-01.txt
2009-02-28.txt
2009-02-29.txt

2009-01-01.txt <- You can see it when you press 'Older' twice
2009-02-28.txt <- You can see it when you press 'Older' once.
2009-02-29.txt <- The latest news will be presented to players when they join the server, or open the menu

So all you have to do is:
Copy the PHP script into a file, name it whatever you want as long as it ends with .php
Stick it onto your server.
Create a folder inside the folder where the script is located and name it 'news'
Put your news in the 'news' folder, using dates as filenames. Extensions are not important for the news articles.

If you need any help setting this up, just ask me :)

Zofo

  • Community Leaders
  • Registered Forum Member
  • ******
  • Posts: 3039
  • Karma: +41/-7
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #5 on: June 12, 2009, 16:32:06 PM »
Quote from: "Zeus"

Yes I will post when I have something to post about, not like others who just post  :violence-hammer:  :lol:



hehe so true

Zeus

  • Community Leaders
  • Registered Forum Member
  • ******
  • Posts: 2067
  • Karma: +13/-2
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #6 on: June 12, 2009, 17:01:06 PM »
and what changes need doing to the UTRBTTNews.ini

Code: [Select]
[MutNews UTUIDataProvider_Mutator]
ClassName=RBTTNews.MutNews
FriendlyName=RBTTNews v1.1
Description=News application
GroupNames=
UIConfigScene=
bStandaloneOnly=False
BitValue=0
bRemoveOn360=False
bRemoveOnPC=False
bRemoveOnPS3=False

[RBTTNews.MutNews]
;The server TargetFile is on
Server=www.rbthinktank.com
;The complete URL to the file you need to load
TargetFile=http://www.rbthinktank.com/RBUT3ServerNews/readnews.php

for that to work?

FakeTruth

  • Registered Forum Member
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #7 on: June 12, 2009, 17:16:34 PM »
Replace Server with the IP or domain to your website/webserver
Replace TargetFile with the complete URL to the PHP script that handles presenting the news

Zeus

  • Community Leaders
  • Registered Forum Member
  • ******
  • Posts: 2067
  • Karma: +13/-2
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #8 on: June 16, 2009, 13:19:07 PM »
Ok had a little play with this and with your settings all works fine

So for the script you did what program should I use (I used notepad) plus what changes do I need to the script so that the news is stored in the same directory as the *.php file. Having a little trouble getting subdirectory working on the server I plan to use  :violin:

FakeTruth

  • Registered Forum Member
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #9 on: June 17, 2009, 21:37:37 PM »
it IS possible to have it in the same directory, but I wouldn't recommend it. You should just use a clean directory. You'd also need a different PHP script for that

Zeus

  • Community Leaders
  • Registered Forum Member
  • ******
  • Posts: 2067
  • Karma: +13/-2
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #10 on: June 17, 2009, 21:45:02 PM »
Thanks for all the help sorting it out and good to see its up and working. Just waiting on Zofo to do the welcome message. Got it on two servers ATM - works with 'The Haunted' TC too. Will have it on all three as soon as the last one is empty  :D

Great to have a message that splashes up with every new map to tell folk what we are about, events, etc etc

Zofo

  • Community Leaders
  • Registered Forum Member
  • ******
  • Posts: 3039
  • Karma: +41/-7
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #11 on: June 18, 2009, 09:17:03 AM »
I have writers block....I will try again in a little while

Zofo

  • Community Leaders
  • Registered Forum Member
  • ******
  • Posts: 3039
  • Karma: +41/-7
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #12 on: June 18, 2009, 09:43:42 AM »
ok what do we want this to say exactly?


This is what I go so far...


Welcome to the Nervous Energy Community Servers







tbh I like it, its got depth and not that complicated  :P

Zeus

  • Community Leaders
  • Registered Forum Member
  • ******
  • Posts: 2067
  • Karma: +13/-2
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #13 on: June 18, 2009, 11:20:48 AM »
Quote from: "Zofo"
ok what do we want this to say exactly?


This is what I go so far...


Welcome to the Nervous Energy Community Servers







tbh I like it, its got depth and not that complicated  :P


But does it cover the gametypes we have on the servers - the custom nights, the map packs where to go to find us what we r all about, how to get a custom map on the servers, how to complain about hackers/aimbots.

So get your brain in friggin gear and get it sorted.

or it will say

Welcome to the Nervous Energy Community Servers
Home of the fun gamers
and  Zofo the spammy, uphill gardener, git who never gets stuff done like this welcome page..
real welcome coming soon.................

your call m8  :lol:

FakeTruth

  • Registered Forum Member
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: RBTTNews v1.1 [Pics][Final]
« Reply #14 on: June 18, 2009, 11:29:27 AM »
Wow, you guys are genius! xD

By the way, you didn't put anything between the <title>tags</title>