Hi !
I invent a script of joke of the day. Every Day, a phrase choose by chance, is show in FNN.
You can use this script to do joke of the day or show every day easy way
Before all Make a backup
Let's go
In root game, create a new file : "joke.php" and paste this code in this file :
<?php
include ("config/config.php");
include ("languages/$langdir/lang_translate_news.inc");
if (isset($_GET['admin_password']))
{
$admin_password = $_GET['admin_password'];
}
else
{
$admin_password = "";
}
if ($admin_password == $adminpass)
{
srand();
$rand = rand(0,$total_joke);
$nbjoke = "joke".$rand;
if (isset($nbjoke))
{
$stamp = date("Y-m-d H:i:s");
$debug_query = $db->Execute("INSERT INTO {$db_prefix}news (data, total, user_id, date, news_type) VALUES ('$rand', '1', '1', '$stamp', 'joke')");
db_op_result($debug_query,__LINE__,__FILE__);
}
echo "Update Joke : OK";
}
else
{
echo "Bad Password";
}
?>
Then Open globals/translate_news.inc
After this :
case "targetdies":
$playerdatas = explode("|", $entry['data']);
$data = str_replace("[name]", $playerdatas[0], $l_news_targetdies_short);
$retvalue['headline'] = str_replace("[owner]", $playerdatas[1], $data);
$data = str_replace("[name]", $playerdatas[0], $l_news_targetdies);
$retvalue['newstext'] = str_replace("[owner]", $playerdatas[1], $data);
break;
Add :
case "joke":
$retvalue['headline'] = $jokeh;
$retvalue['newstext'] = ${"joke".$entry['data']};
break;
Save file then Open globals/translate_news_headline.inc
After this :
case "targetdies":
$playerdatas = explode("|", $entry['data']);
$data = str_replace("[name]", $playerdatas[0], $l_news_targetdies_short);
$retvalue = str_replace("[owner]", $playerdatas[1], $data);
break;
Add :
case "joke":
$retvalue = ${"joke".$entry['data']};
break;
Now you must repeat this in all languages repertory Open languages/.../lang_translate_news.inc
Add before
Add :
// joke of the day
$total_joke = 3; //it is the total number of jokes
$jokeh = "joke of the day";
$joke1 = "Text of the joke1";
$joke2 = "Text of the joke2";
$joke3 = "Text of the joke3";
There can have as many jokes as you want
But don't forget to complet $total_joke
Now The Task Cron
* */24 * * * /usr/bin/lynx --dump http://mygameaatrade/joke.php?admin_password=writeyourpass> /dev/null
You may need to alter the URL to point to your exact domain name and path. You will also need to change the password to your admin password
Finish
If you have a problem ask me
+