• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Znote AAC] Live Cast Page

Nottinghster

Tibia World RPG Developer
Joined
Oct 24, 2007
Messages
1,569
Solutions
6
Reaction score
436
Location
Brazil - Rio de Janeiro
GitHub
Nottinghster
Hello guys !!!

Until now, I didn't saw a Live Cast Page for Znote AAC, only for Gesior AAC.
The page itself, it's kinda simple, because my skills in PHP are not so good, but it's working 100%.

P.S: This page is based on Summ's Cast System!

I did it for my server, but I'm here to share with you guys ;)

This is how it looks like:
7Itw5E.png


PHP:
<?php require_once 'engine/init.php';
include 'layout/overall/header.php'; ?>

<?php
    $cache = new Cache('engine/cache/livecast');
    if ($cache->hasExpired()) {
        $cast = mysql_select_multi('SELECT * FROM players WHERE online = 1 AND cast = 1 ORDER BY name');
        $cache->setContent($cast);
        $cache->save();
    } else {
        $cast = $cache->load();
    }
?>

<table border="0" cellspacing="1" cellpadding="4" width="100%">
    <tr bgcolor="#505050">
        <td class="white"><b><?php echo $config['site_title'] ?> Live Cast System!<b></td>
    </tr>
    <td>
<strong>How to view a cast?</strong>
    <ul>
        <li><strong>Unprotected Cast</strong></li>
        <ul>
            <li>Leave both the account name and password <strong>empty</strong> when you are logging in.</li>
        </ul><br>
        <li><strong>Protected Cast</strong></li>
        <ul>
            <li>If the cast has a password then simply get the password from the caster and enter the game with just the password for the cast.</li>
        </ul>
    </ul>
    </td>
</table>

<table border="0" cellspacing="1" cellpadding="4" width="100%">
    <tr bgcolor="#505050">
        <td class="white"><b>Cast Commands<b></td>
    </tr>
    <td>
        <strong><u>Commands for streamers:</u></strong><br><br>
        <font color="brown"><strong>/cast on</font></strong>  - enables the stream<br />
        <font color="brown"><strong>/cast off</font></strong>  - disables the stream<br />
        <font color="brown"><strong>/cast password {password}</font></strong>  - sets a password on the stream<br />
        <font color="brown"><strong>/cast password off</font></strong>  - disables the password protection<br />
        <font color="brown"><strong>/cast kick {name}</font></strong>  - kick a spectator from your stream<br />
        <font color="brown"><strong>/cast ban {name}</font></strong>  - locks spectator IP from joining your stream<br />
        <font color="brown"><strong>/cast unban {name}</font></strong>  - removes banishment lock<br />
        <font color="brown"><strong>/cast bans</font></strong>  - shows banished spectators list<br /><br />
        <font color="brown"><strong>/cast mute {name}</font></strong>  - mutes selected spectator from chat<br />
        <font color="brown"><strong>/cast unmute {name}</font></strong>  - removes mute<br />
        <font color="brown"><strong>/cast mutes</font></strong>  - shows muted spectators list<br />
        <font color="brown"><strong>/cast viewers</font></strong>  - displays the amount and nicknames of current spectators<br />
        <font color="brown"><strong>/cast status</font></strong> - displays stream info
    </td>
</table>

<?php
if (empty($cast) || $cast === false) {
?>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
    <tr bgcolor="#505050">
        <td class="white">
            <b>Live Casts</b>
        </td>
    </tr>
    <tr bgcolor="#D4C0A1">
        <td><center>Currently there are no active casts on <?php echo $config['site_title'] ?>!</center></td>
    </tr>
</table>
<?php } else { ?>
<h1>Live Casts</h1>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
    <tr bgcolor="#505050">
        <td class="white" width="10%"><center><b>Player Name</b></center></td>
        <td class="white" width="10%"><center><b>Description</b></center></td>
        <td class="white" width="10%"><center><b>Viewers</b></center></td>
    </tr>
    <?php
    foreach ($cast as $getCast) {
    ?>
    <tr bgcolor="#F1E0C6">
        <td class="white"><center><a href="characterprofile.php?name=<?php urlencode($getCast['name']) ?>"><?php echo $getCast['name'] ?></a></center></td>
        <td class="white"><center><b><?php echo $getCast['castDescription'] == "" ? '-' : $getCast['castDescription'] ?></b></center></td>
        <td class="white"><center><b><?php echo $getCast['castViewers'] ?>/50</b></center></td>
    </tr> <?php } } ?>
</table>

<p align="right"><small>Page converted by <a href="https://otland.net/members/nottinghster.3619/">Nottinghster</a>.</small></p>
      
<?php include 'layout/overall/footer.php'; ?>

Hope you enjoy it !!!
 
I added this to database:
Code:
ALTER TABLE  `players` ADD  `cast` TINYINT NOT NULL DEFAULT  '0',
ADD  `castViewers` INT( 11 ) NOT NULL DEFAULT  '0',
ADD  `castDescription` VARCHAR( 255 ) NOT NULL

but cast always stays 0 in Players. Should it be 'Update * FROM, when player comment /cast on or sth? cuz not working
 
I started my cast, but show on website:
Currently there are no active casts on Server!
 
Try to change this:
PHP:
$cast = mysql_select_multi('SELECT * FROM players WHERE online = 1 AND cast = 1 ORDER BY name');
To this
PHP:
$cast = mysql_select_multi('SELECT * FROM players WHERE online > 0 AND cast = 1 ORDER BY name');
 
Try to change this:
PHP:
$cast = mysql_select_multi('SELECT * FROM players WHERE online = 1 AND cast = 1 ORDER BY name');
To this
PHP:
$cast = mysql_select_multi('SELECT * FROM players WHERE online > 0 AND cast = 1 ORDER BY name');

This two options show: Currently there are no active casts on Server!
 
This works for the OTX2 cast:

Code:
<?php require_once 'engine/init.php';
include 'layout/overall/header.php'; ?>

<?php
  $cache = new Cache('engine/cache/livecast');
  if ($cache->hasExpired()) {
  $cast = mysql_select_multi('SELECT * FROM players WHERE online = 1 AND broadcasting = 1 ORDER BY name');
  $cache->setContent($cast);
  $cache->save();
  } else {
  $cast = $cache->load();
  }
?>

<table border="0" cellspacing="1" cellpadding="4" width="100%">
  <tr bgcolor="#505050">
  <td class="white"><b><?php echo $config['site_title'] ?> Live Cast System!<b></td>
  </tr>
  <td>
<strong>How to view a cast?</strong>
  <ul>
  <li><strong>Unprotected Cast</strong></li>
  <ul>
  <li>Leave both the account name and password <strong>empty</strong> when you are logging in.</li>
  </ul><br>
  <li><strong>Protected Cast</strong></li>
  <ul>
  <li>If the cast has a password then simply get the password from the caster and enter the game with just the password for the cast.</li>
  </ul>
  </ul>
  </td>
</table>

<table border="0" cellspacing="1" cellpadding="4" width="100%">
  <tr bgcolor="#505050">
  <td class="white"><b>Cast Commands<b></td>
  </tr>
  <td>
  <strong><u>Commands for streamers:</u></strong><br><br>
  <font color="brown"><strong>/cast on</font></strong>  - enables the stream<br />
  <font color="brown"><strong>/cast off</font></strong>  - disables the stream<br />
  <font color="brown"><strong>/cast password {password}</font></strong>  - sets a password on the stream<br />
  <font color="brown"><strong>/cast password off</font></strong>  - disables the password protection<br />
  <font color="brown"><strong>/cast kick {name}</font></strong>  - kick a spectator from your stream<br />
  <font color="brown"><strong>/cast ban {name}</font></strong>  - locks spectator IP from joining your stream<br />
  <font color="brown"><strong>/cast unban {name}</font></strong>  - removes banishment lock<br />
  <font color="brown"><strong>/cast bans</font></strong>  - shows banished spectators list<br /><br />
  <font color="brown"><strong>/cast mute {name}</font></strong>  - mutes selected spectator from chat<br />
  <font color="brown"><strong>/cast unmute {name}</font></strong>  - removes mute<br />
  <font color="brown"><strong>/cast mutes</font></strong>  - shows muted spectators list<br />
  <font color="brown"><strong>/cast viewers</font></strong>  - displays the amount and nicknames of current spectators<br />
  <font color="brown"><strong>/cast status</font></strong> - displays stream info
  </td>
</table>

<?php
if (empty($cast) || $cast === false) {
?>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
  <tr bgcolor="#505050">
  <td class="white">
  <b>Live Casts</b>
  </td>
  </tr>
  <tr bgcolor="#D4C0A1">
  <td><center>Currently there are no active casts on <?php echo $config['site_title'] ?>!</center></td>
  </tr>
</table>
<?php } else { ?>
<h1>Live Casts</h1>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
  <tr bgcolor="#505050">
  <td class="white" width="10%"><center><b>Player Name</b></center></td>
  <td class="white" width="10%"><center><b>Viewers</b></center></td>
  </tr>
  <?php
  foreach ($cast as $getCast) {
  ?>
  <tr bgcolor="#F1E0C6">
  <td class="white"><center><a href="characterprofile.php?name=<?php urlencode($getCast['name']) ?>"><?php echo $getCast['name'] ?></a></center></td>
  <td class="white"><center><b><?php echo $getCast['viewers'] ?>/50</b></center></td>
  </tr> <?php } } ?>
</table>

<p align="right"><small>Page converted by <a href="https://otland.net/members/nottinghster.3619/">Nottinghster</a>.</small></p>
  
<?php include 'layout/overall/footer.php'; ?>
 
This works for the OTX2 cast:

Code:
<?php require_once 'engine/init.php';
include 'layout/overall/header.php'; ?>

<?php
  $cache = new Cache('engine/cache/livecast');
  if ($cache->hasExpired()) {
  $cast = mysql_select_multi('SELECT * FROM players WHERE online = 1 AND broadcasting = 1 ORDER BY name');
  $cache->setContent($cast);
  $cache->save();
  } else {
  $cast = $cache->load();
  }
?>

<table border="0" cellspacing="1" cellpadding="4" width="100%">
  <tr bgcolor="#505050">
  <td class="white"><b><?php echo $config['site_title'] ?> Live Cast System!<b></td>
  </tr>
  <td>
<strong>How to view a cast?</strong>
  <ul>
  <li><strong>Unprotected Cast</strong></li>
  <ul>
  <li>Leave both the account name and password <strong>empty</strong> when you are logging in.</li>
  </ul><br>
  <li><strong>Protected Cast</strong></li>
  <ul>
  <li>If the cast has a password then simply get the password from the caster and enter the game with just the password for the cast.</li>
  </ul>
  </ul>
  </td>
</table>

<table border="0" cellspacing="1" cellpadding="4" width="100%">
  <tr bgcolor="#505050">
  <td class="white"><b>Cast Commands<b></td>
  </tr>
  <td>
  <strong><u>Commands for streamers:</u></strong><br><br>
  <font color="brown"><strong>/cast on</font></strong>  - enables the stream<br />
  <font color="brown"><strong>/cast off</font></strong>  - disables the stream<br />
  <font color="brown"><strong>/cast password {password}</font></strong>  - sets a password on the stream<br />
  <font color="brown"><strong>/cast password off</font></strong>  - disables the password protection<br />
  <font color="brown"><strong>/cast kick {name}</font></strong>  - kick a spectator from your stream<br />
  <font color="brown"><strong>/cast ban {name}</font></strong>  - locks spectator IP from joining your stream<br />
  <font color="brown"><strong>/cast unban {name}</font></strong>  - removes banishment lock<br />
  <font color="brown"><strong>/cast bans</font></strong>  - shows banished spectators list<br /><br />
  <font color="brown"><strong>/cast mute {name}</font></strong>  - mutes selected spectator from chat<br />
  <font color="brown"><strong>/cast unmute {name}</font></strong>  - removes mute<br />
  <font color="brown"><strong>/cast mutes</font></strong>  - shows muted spectators list<br />
  <font color="brown"><strong>/cast viewers</font></strong>  - displays the amount and nicknames of current spectators<br />
  <font color="brown"><strong>/cast status</font></strong> - displays stream info
  </td>
</table>

<?php
if (empty($cast) || $cast === false) {
?>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
  <tr bgcolor="#505050">
  <td class="white">
  <b>Live Casts</b>
  </td>
  </tr>
  <tr bgcolor="#D4C0A1">
  <td><center>Currently there are no active casts on <?php echo $config['site_title'] ?>!</center></td>
  </tr>
</table>
<?php } else { ?>
<h1>Live Casts</h1>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
  <tr bgcolor="#505050">
  <td class="white" width="10%"><center><b>Player Name</b></center></td>
  <td class="white" width="10%"><center><b>Viewers</b></center></td>
  </tr>
  <?php
  foreach ($cast as $getCast) {
  ?>
  <tr bgcolor="#F1E0C6">
  <td class="white"><center><a href="characterprofile.php?name=<?php urlencode($getCast['name']) ?>"><?php echo $getCast['name'] ?></a></center></td>
  <td class="white"><center><b><?php echo $getCast['viewers'] ?>/50</b></center></td>
  </tr> <?php } } ?>
</table>

<p align="right"><small>Page converted by <a href="https://otland.net/members/nottinghster.3619/">Nottinghster</a>.</small></p>
 
<?php include 'layout/overall/footer.php'; ?>

Code:
string(73) "SELECT * FROM players WHERE online = 1 AND broadcasting = 1 ORDER BY name" 
(query - SQL error) 
Type: select_multi (select multiple rows from database)

Unknown column 'broadcasting' in 'where clause'
 
Back
Top