Daily Lucky Numbers:
1
2
15
28
30
43

Recent posts

#21
General Code/Script Inquiries / Re: Hide content
Last post by Dave - September 20, 2025, 08:12:13 AM
It's worth noting with the above file that some language files have been removed. That was done so that new languge files can be added by others.
#22
General Code/Script Inquiries / Re: Hide content
Last post by Dave - September 20, 2025, 05:32:07 AM
Quote from: Dave on September 20, 2025, 04:26:42 AMI have attached a mod that was used in 2.0 that does what you want, but it needs updating to 2.1 if you want to use it on the latest SMF version

That particular file attached in the previous post has a mysql error, I've fixed that in the one attached to this post. I have installed this on a test 2.0 site I have on localhost and it works fine, so you just need someone to update it for 2.1
#23
General Code/Script Inquiries / Re: Hide content
Last post by Dave - September 20, 2025, 04:26:42 AM
I have attached a mod that was used in 2.0 that does what you want, but it needs updating to 2.1 if you want to use it on the latest SMF version
#24
SMF Arcade Support + Plugins / Re: move/remove/change placmen...
Last post by Chen Zhen - August 28, 2025, 05:54:34 PM
There are different skins & lists to choose from which show that info in different formats.
However, currently there isn't a skin that allows an admin to change the order of its layout other than enabling/disabling some of what is displayed and/or the amount of info displayed (ie. number of champions, games, etc.).

If you have some HTML/JavaScript/CSS experience then you can manually edit a skin template to a custom display of Arcade data.
This sort of thing can also be developed to use a skin hook that can be shared amongst Arcade admins.



#25
SMF Arcade Support + Plugins / move/remove/change placment of...
Last post by itsacrossthing - August 28, 2025, 12:54:33 PM
hey all first of brillient job on the arcade modifacation i love it!

however im wondering how/if i could rearrange/remove certain iitemsin the arcade info screen (latest games, champions ect)

any help would be greatly recieved
#26
SMF Arcade Support + Plugins / Re: Undefined array key "rese...
Last post by Duban Black - August 06, 2025, 08:29:07 PM
Quote from: Chen Zhen on July 27, 2025, 11:16:58 PMNo need to apologize.. I haven't been very active online for some time now.
12 hour shifts will do that!  :blank:

I'm not positive I understand the Arcade email behavior.
So I think you're saying precursory is working but signature and inline css is not?
 

Precursory works correctly, but the following are not displayed correctly:
- The signature
- Custom Inline CSS
- Message Inline CSS

All this data is configured in Zhenmailer, but Arcade does not use it.
I understand that the arcade code must be edited to include those values in the same way that the precursor was included.
#27
SMF Arcade Block Codes / Re: High Scores/Stats Block (V...
Last post by Dave - July 28, 2025, 03:46:00 AM
Hi Chen,

That's working fine now tested on both Hobby and Quizland, thank you
#28
SMF Arcade Support + Plugins / Re: Undefined array key "rese...
Last post by Chen Zhen - July 27, 2025, 11:16:58 PM

No need to apologize.. I haven't been very active online for some time now.
12 hour shifts will do that!  :blank:

I'm not positive I understand the Arcade email behavior.
So I think you're saying precursory is working but signature and inline css is not?
 
#29
SMF Arcade Block Codes / Re: High Scores/Stats Block (V...
Last post by Chen Zhen - July 27, 2025, 11:10:11 PM
I see I neglected to put in backslashes which caused it to throw an error.
Anonymous functions can be used to negate the use of backslashes in that part of the code.

The cache was messing up the use of that best players function, so try this with a custom function included:

/* High Scores/Stats PHP Block */
/**************************
    set $gameTypes
    0 = Permission based
    1 = Flash/HTML
    2 = ROM only
    3 = All game types
**************************/
global $settings, $scripturl, $sourcedir, $boardurl, $smcFunc, $arcadeModSettings, $boarddir;
require_once($boarddir . '/ArcadeSources/ArcadeStats.php');

$no = 10; //number of top players to show
$txtplay = "The Top Players"; // change "The Top Players" to your language
$txtwin = "Number Of Wins :";// change "Number Of Wins :" to your language
$txtlate = "Latest High Score by ";// change "Latest High Score set by" to your language
$txtwit = "with ";// change "with" to your language
$txton = "on ";// change "on" to your language
$arcade_icon = 'arcade.jpg';
$gameTypes = 0;

switch($gameTypes) {
    case 1:
        $where = ' WHERE rom_flag = {int:romflag}';
        $romflag = 0;
        break;
    case 2:
        $where = ' WHERE rom_flag = {int:romflag}';
        $romflag = 1;
        break;
    case 3:
        $where = '';
        $romflag = 0;
        break;
    default:
        $romflag = 0;
        if (allowedTo('arcade_view_retro_arch')) {
            $where = '';
        }
        else {
            $where = ' WHERE rom_flag = {int:romflag}';
        }
}

$no_games = 8;
$icons_per_row = 4;
$mydisplays = true;
$check_game = !empty($_REQUEST['game']) ? (int) $_REQUEST['game'] : 0;
$no_games = !empty($check_game) ? 28 : 12;
$display = RandomArcadeDatum($no, $txtplay, $txtwin, $txtlate, $txtwit, $txton, $arcade_icon, $gameTypes, $no_games, $icons_per_row, $mydisplays, $check_game, $where, $romflag);

function RandomArcadeDatum($no, $txtplay, $txtwin, $txtlate, $txtwit, $txton, $arcade_icon, $gameTypes, $no_games, $icons_per_row, $mydisplays, $check_game, $where, $romflag)
{
    global $settings, $scripturl, $sourcedir, $boardurl, $smcFunc, $arcadeModSettings, $boarddir;

    if (!allowedTo('arcade_view') && $gameTypes == 0) {
        return false;
    }

    $request = $smcFunc['db_query']('', '
        SELECT  game.id_game, game.game_name, game.thumbnail, game.game_directory, game.rom_flag,
        IFNULL(mem.id_member, 0) AS id_member, IFNULL(mem.real_name, {string:rname}) AS player_name, score.score
        FROM {db_prefix}arcade_scores AS score
        LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = score.id_member)
        RIGHT JOIN {db_prefix}arcade_games AS game ON (game.id_game = score.id_game)' . (str_replace('rom_flag', 'game.rom_flag', $where)) . '
        ORDER BY champion_from DESC
        LIMIT 0,1',
        array('rname' => '???', 'romflag' => $romflag)
    );
    if(!$request)
      die("Could not get the newest champ");

    $row = $smcFunc['db_fetch_assoc']($request);
    $smcFunc['db_free_result']($request);

    if(isset($row['game_directory']))
      $row['game_directory'] = $row['game_directory'];

    //newest champ details
    $playerid = $row['id_member'];
    $player = !empty($row['real_name']) ? $row['real_name'] : $row['player_name'];
    $game_id = $row['id_game'];
    $game_name = $row['game_name'];
    $score = $row['score'];
    $game_pic = (!empty($row['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl']) . '/' . $row['game_directory'] . '/' . $row['thumbnail'];
    $arcadePic = file_exists($settings['default_theme_dir'] . '/images/arc_icons/' . $arcade_icon) ? '<img style="border: 0px;height: 3em;width: 8em;" src="' . $settings['default_theme_url'] . '/images/arc_icons/' . $arcade_icon . '" alt="" />' : '<img style="border: 0px;height: 5em;width: 5em;" src="' . $settings['default_theme_url'] . '/images/arc_icons/thearcade.png" alt="" />';
    $bp=ArcadeStats_BestPlayers2($no);
    $bp = !empty($bp) ? $bp : [];
    for ($x=1;$x<=$no;$x++) {
        $imgFile = file_exists($settings['default_theme_dir'] . '/images/arc_icons/' . $x . '.gif') ? $settings['default_theme_url'] . '/images/arc_icons/' . $x . '.gif' : $settings['default_theme_url'] . '/images/arc_icons/trophy.png';
        $trophy[$x] = '<img src="' . $imgFile . '" border= "0" alt="#' . $x . ' Score" />';
    }
    $score_poss=0; //players position

    echo '
        <script type="text/javascript">
            var delayb4scrollx = 2000;
            var marqueespeedx = 1;
            var pauseitx = 1;
            var copyspeedx = marqueespeedx;
            var pausespeedx = pauseitx == 0 ? copyspeedx : 0;
            var actualheightx = "";

            function scrollmarqueex(){
                if (parseInt(cross_marqueex.style.top)>(actualheightx*(-1)+8))
                    cross_marqueex.style.top=parseInt(cross_marqueex.style.top)-copyspeedx+"px"
                else
                    cross_marqueex.style.top=parseInt(marqueeheightx)+8+"px"
            }

            function initializemarqueex(){
                cross_marqueex = document.getElementById("vmarqueex");
                cross_marqueex.style.top = 0;
                marqueeheightx = document.getElementById("marqueecontainerx").offsetHeight;
                actualheightx = cross_marqueex.offsetHeight;
                if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){
                    cross_marqueex.style.height = marqueeheightx+"px";
                    cross_marqueex.style.overflow = "scroll";
                    return;
                }
                setTimeout(function(){setInterval(function(){scrollmarqueex();},30);}, delayb4scrollx);
            }

            $( document ).ready(function() {
                initializemarqueex();
            });
        </script>
    <div style="overflow: hidden;">
        <div style="display:table;width: 100%;text-align: center;overflow: hidden;">
            <div style="display: table-row;">
                <div style="display: table-cell;text-align: center;">
                    <span style="display: block;line-height: 1em;"></span>
                    <a href="', $scripturl, '?action=arcade">
                        ', $arcadePic, '
                    </a>
                    <span style="display: block;line-height: 2em;"></span>
                </div>
            </div>
        </div>
    </div>';
    if ($mydisplays == true || $check_game == true) {
        /* Start 1 of 4 random stats display above top 10 marquee  */
        $random_games_choice = random_int(1,4);
        $games_choice = 'games'.$random_games_choice;
        $curr_position = 0;
        $games_choice($no_games,$curr_position,$icons_per_row, '', $no, $gameTypes, $where, $romflag);
        /* END random stats display */
    }
    if ($check_game == false)
    {
        echo '
    <div class="centertext" style="display: flex;justify-content: center;overflow: hidden;">
        <div id="marqueecontainerx" style="position: relative; width: 100%; height:200px; overflow: hidden; border: 0px;" onmouseover="copyspeedx=pausespeedx" onmouseout="copyspeedx=marqueespeedx">
            <div id="vmarqueex" style="position: absolute; width: 100%;">
                <div class="centertext">
                    <a href="', $scripturl, '?action=arcade;sa=play;game=', $game_id, '">
                        <img src="' . $game_pic . '" border="0" alt="' . $game_name . '" style="width: 4em;height: 4em;"/>
                    </a>
                    <span style="display: block;line-height: 1em;"></span>', $txtlate, '<span style="display: block;line-height: 1em;"></span>
                    <a href="', $scripturl, '?action=profile;u=', $playerid, '">', $player, '</a>
                    <span style="display: block;line-height: 1em;"></span>
                    ', $txtwit, ' ', $score, ' ', $txton, '
                    <span style="display: block;line-height: 1em;"></span>', $game_name, '
                    <span style="display: block;line-height: 1em;"></span>
                    <div style="width: 20%;margin: 0 auto;line-height: 0.2em;"><hr style="border-top: 1px dashed;" /></div>
                    <span style="display: block;line-height: 1em;"></span>
                    <span style="font: italic small-caps bold 12px/30px Georgia, serif;padding: 1em;">', $txtplay, '</span>
                    <span style="display: block;line-height: 2em;"></span>';
        foreach ($bp as $out) {
            $score_poss++;
            if ($score_poss > 10)
                $trophy[$score_poss] = '[' . $score_poss . ']';

            echo $trophy[$score_poss], '
                    <span style="display: block;line-height: 1em;"></span>
                    ' . $out['link'] . '
                    <span style="display: block;line-height: 1em;"></span>
                    ' . $txtwin . ' ' . $out['champions'] . '
                    <span style="display: block;line-height: 1em;"></span>
                    <div style="width: 30%;margin: 0 auto;line-height: 0.2em;"><hr style="border-top: 1px dashed;" /></div>
                    <span style="display: block;line-height: 1em;"></span>';
        }
    }

    echo '
                </div>
            </div>
        </div>
    </div>';
    return true;
}

/* START - Display Functions */
function games3($no_games,$curr_position,$icons_per_row, $gamesUrl, $no, $gameTypes, $where, $romflag)
{
    //show the latest games
    global $smcFunc, $scripturl, $arcadeModSettings;

    echo '
    <div style="width: 100%;margin: 0 auto;text-align: center;overflow: hidden;">Latest Games
        <span style="display: block;line-height: 1em;"></span>
        <div style="display: table;border-spacing: 5px;margin: 0 auto;">
            <div style="display: table-row;">';

    $result = $smcFunc['db_query']('', '
        SELECT id_game, game_name, thumbnail, game_directory, rom_flag
        FROM {db_prefix}arcade_games' . $where . '
        ORDER BY id_game DESC, game_name DESC
        LIMIT 0,{int:no}',
        array(
            'no' => $no_games, 'romflag' => $romflag
        )
    );

    while ($game = $smcFunc['db_fetch_assoc']($result))
    {
        $path = str_replace('', '/', (!empty($game['rom_flag']) ? $arcadeModSettings['romGamesDirectory'] : $arcadeModSettings['gamesDirectory']));
        $filepath = rtrim($path, '/');
        $gamesUrl = !empty($game['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl'];
        $action = !empty($game['rom_flag']) ? 'retro_arch' : 'arcade';
        $game_thumb = $gamesUrl . '/' . $game['game_directory'] . '/' . $game['thumbnail'];
        if($curr_position == $icons_per_row)
        {
            echo '
                </div>
                <div style="display: table-row;">';
            $curr_position=0;
        }
        echo'
                <div style="display: table-cell;padding: 2px;">
                    <a href="'.$scripturl.'?action=' . $action . ';sa=play;game='.$game['id_game'].'">
                    <img src="'.$game_thumb.'" alt="'.$game['game_name'].'" style="border: 0px;width: 30px;height: 30px;" title="Play '.$game['game_name'].'" /></a>
                </div>';
      $curr_position++;
  }
  $smcFunc['db_free_result']($result);

  echo '
            </div>
        </div>
    </div>';
}

function games1($no_games,$curr_position,$icons_per_row, $gamesUrl, $no, $gameTypes, $where, $romflag)
{
    //show most played games (one score version only)
    global $smcFunc, $scripturl, $arcadeModSettings;

    echo '
    <div style="width: 100%;margin: 0 auto;text-align: center;overflow: hidden;">Most Played
        <span style="display: block;line-height: 1em;"></span>
        <div style="display: table;border-spacing: 5px;margin: 0 auto;">
            <div style="display: table-row;">';

    $result = $smcFunc['db_query']('', '
        SELECT id_game, game_name, thumbnail, game_directory, rom_flag, num_plays
        FROM {db_prefix}arcade_games' . $where . '
        ORDER BY num_plays DESC , game_name ASC
        LIMIT 0,{int:no}',
        array(
            'no' => $no_games, 'romflag' => $romflag,
        )
    );

    while ($game = $smcFunc['db_fetch_assoc']($result))
    {
        $path = str_replace('', '/', (!empty($game['rom_flag']) ? $arcadeModSettings['romGamesDirectory'] : $arcadeModSettings['gamesDirectory']));
        $filepath = rtrim($path, '/');
        $gamesUrl = !empty($game['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl'];
        $action = !empty($game['rom_flag']) ? 'retro_arch' : 'arcade';
        $game_thumb = $gamesUrl . '/' . $game['game_directory'] . '/' . $game['thumbnail'];
        if($curr_position == $icons_per_row)
        {
            echo '
                </div>
                <div style="display: table-row;">';
            $curr_position=0;
        }
        echo'
                <div style="display: table-cell;padding: 2px;">
                    <a href="'.$scripturl.'?action=' . $action . ';sa=play;game='.$game['id_game'].'">
                    <img src="'.$game_thumb.'" alt="'.$game['game_name'].'" style="border: 0px;width: 30px;height: 30px;" title="Play '.$game['game_name'].'" /></a>
                </div>';
        $curr_position++;
    }

    $smcFunc['db_free_result']($result);

  echo '
            </div>
        </div>
    </div>';
}

function games4($no_games,$curr_position,$icons_per_row, $gamesUrl, $no, $gameTypes, $where, $romflag)
{
  //show least played games (one score version only)
  global $smcFunc, $scripturl, $arcadeModSettings;

  echo '
    <div style="width: 100%;margin: 0 auto;text-align: center;overflow: hidden;">Least Played
        <span style="display: block;line-height: 1em;"></span>
        <div style="display: table;border-spacing: 5px;margin: 0 auto;">
            <div style="display: table-row;">';

    $result = $smcFunc['db_query']('', '
        SELECT id_game, game_name, thumbnail, game_directory, num_plays, rom_flag
        FROM {db_prefix}arcade_games' . $where . '
        ORDER BY num_plays ASC , game_name ASC
        LIMIT 0,{int:no}',
        array(
            'no' => $no_games, 'romflag' => $romflag,
        )
    );

    while ($game = $smcFunc['db_fetch_assoc']($result))
    {
        $path = str_replace('', '/', (!empty($game['rom_flag']) ? $arcadeModSettings['romGamesDirectory'] : $arcadeModSettings['gamesDirectory']));
        $filepath = rtrim($path, '/');
        $gamesUrl = !empty($game['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl'];
        $action = !empty($game['rom_flag']) ? 'retro_arch' : 'arcade';
        $game_thumb = $gamesUrl . '/' . $game['game_directory'] . '/' . $game['thumbnail'];
        if($curr_position == $icons_per_row)
        {
            echo '
                </div>
                <div style="display: table-row;">';
            $curr_position=0;
        }
        echo '
                <div style="display: table-cell;padding: 2px;">
                    <a href="'.$scripturl.'?action=' . $action . ';sa=play;game='.$game['id_game'].'">
                    <img src="'.$game_thumb.'" alt="'.$game['game_name'].'" style="border: 0px;width: 30px;height: 30px;" title="Play '.$game['game_name'].'" /></a>
                </div>';
        $curr_position++;
    }
    $smcFunc['db_free_result']($result);

  echo '
            </div>
        </div>
    </div>';
}

function games2($no_games,$curr_position,$icons_per_row, $gamesUrl, $no, $gameTypes, $where, $romflag)
{
    //show best rated games
    global $smcFunc, $scripturl, $arcadeModSettings;

    echo '
    <div style="width: 100%;margin: 0 auto;text-align: center;overflow: hidden;">Top Rated
    <span style="display: block;line-height: 1em;"></span>
        <div style="display: table;border-spacing: 5px;margin: 0 auto;">
            <div style="display: table-row;">';

    $result = $smcFunc['db_query']('', '
        SELECT id_game, game_name, thumbnail, game_directory, game_rating, rom_flag
        FROM {db_prefix}arcade_games' . $where . '
        ORDER BY game_rating DESC , game_name ASC
        LIMIT 0,{int:no}',
        array(
            'no' => $no_games, 'romflag' => $romflag,
        )
    );

    while ($game = $smcFunc['db_fetch_assoc']($result))
    {
        $path = str_replace('', '/', (!empty($game['rom_flag']) ? $arcadeModSettings['romGamesDirectory'] : $arcadeModSettings['gamesDirectory']));
        $filepath = rtrim($path, '/');
        $gamesUrl = !empty($game['rom_flag']) ? $arcadeModSettings['romGamesUrl'] : $arcadeModSettings['gamesUrl'];
        $action = !empty($game['rom_flag']) ? 'retro_arch' : 'arcade';
        $game_thumb = $gamesUrl . '/' . $game['game_directory'] . '/' . $game['thumbnail'];
        if($curr_position == $icons_per_row)
        {
            echo '</div><div style="display: table-row;">';
            $curr_position=0;
        }
        echo'
                <div style="display: table-cell;padding: 2px;">
                    <a href="'.$scripturl.'?action=' . $action . ';sa=play;game='.$game['id_game'].'">
                    <img src="'.$game_thumb.'" alt="'.$game['game_name'].'" style="border: 0px;width: 30px;height: 30px;" title="Play '.$game['game_name'].'" /></a>
                </div>';
        $curr_position++;
    }

    $smcFunc['db_free_result']($result);

  echo '
            </div>
        </div>
    </div>';
}

function ArcadeStats_BestPlayers2($count = 10, $rom = 0)
{
    // Returns best players by count of champions
    global $db_prefix, $scripturl, $txt, $smcFunc, $arcadeModSettings;

    $action = isset($_REQUEST['action']) && $_REQUEST['action'] == 'retro_arch' ? 'retro_arch' : (isset($_REQUEST['action']) && $_REQUEST['action'] == 'arcade' ? 'arcade' : '');
    $rom = !empty($_SESSION['arcade_rom_initiate']) && !empty($action) ? 1 : ($action == 'retro_arch' ? 1 : $rom);
    $rom2 = !empty($rom) ? '_rom' : '';
    $where = empty($arcadeModSettings['arcadeRomToggle']) && $rom > -1 ? ' AND game.rom_flag = {int:romflag}' : '';
    $top = [];
    $request = $smcFunc['db_query']('', '
        SELECT COUNT(*) AS champions, game.rom_flag, IFNULL(mem.id_member, 0) AS id_member, IFNULL(mem.real_name, {string:empty}) AS real_name
        FROM {db_prefix}arcade_games AS game
            LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = game.id_champion)
        WHERE game.id_champion_score > 0' . $where . '
        GROUP BY game.id_champion, id_member, real_name, game.rom_flag
        ORDER BY champions DESC
        LIMIT {int:count}',
        array(
            'count' => $count,
            'empty' => '',
            'romflag' => $rom,
        )
    );
    $max = -1;

    while ($score = $smcFunc['db_fetch_assoc']($request))
    {
        if ($max == -1)
            $max = $score['champions'];

        $top[] = array(
            'name' => $score['real_name'],
            'link' => !empty($score['real_name']) ? '<a href="' . $scripturl . '?action=profile;u=' . $score['id_member'] . '">' .  $score['real_name'] . '</a>' : $txt['guest'],
            'champions' => comma_format($score['champions']),
            'precent' => ($score['champions'] / $max) * 100,
        );
    }
    $smcFunc['db_free_result']($request);

    $top = !empty($arcadeBestPlayers) ? json_decode($arcadeBestPlayers, true) : $top;

    if (count($top) == 0)
        return false;
    elseif ($count > 1)
        return $top;
    else
        return $top[0];
}



Please let me know if it works so I can replace the function in the OP.

#30
SMF Arcade Support + Plugins / Re: Undefined array key "rese...
Last post by Duban Black - July 26, 2025, 05:48:53 PM
Quote from: Chen Zhen on June 26, 2025, 10:22:12 PMIf you don't mind testing a possible fix, please download the attached file and overwrite the existing file located in this path:
\ArcadeSources




Please let me know if it resolves your reported issue.

I apologize for taking so long to respond. I had a very difficult month. With the new code, the first part of the email was fixed, but the body and signature are not correct. I am leaving the evidence.