/****************************************************************************** * Tiny Portal/SMF Arcade - Combined Games and Scrolling Champ Block * ******************************************************************************* * * File by: Eric Lawson - www.ericsworld.eu * ******************************************************************************* * * * To install: * * Copy the entire contents (crtl+a)(ctrl+c) of this file into a phpblock * * * * Edits: * * Change the txt strings to suit your language. * * Set $no_topten = * * Set $gamesUrl = * * Set $no_games = * * Set $icons_per_row = * * Set $gamesUrl = * * * * Uploads: * * Upload a pic called arcade_block.gif * * (you can use you own gif - just name it arcade_block.gif) to each: * * Themes//images/ * * * * This file is distributed in the hope that it is and will be useful, * * but WITHOUT ANY WARRANTIES; without even any implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * * ******************************************************************************/ global $gamesUrl; /*******EDITS*****************************************************************/ $no_games=8; $icons_per_row = 4; $no_topten = 10; $gamesUrl = 'http://www.smacznie.org.pl//Games/'; // --LANGUAGE EDITS -- $txtplay = "Nasi gracze"; // change "The Top Players" to your language $txtwin = "Pozycja :";// change "Number Of Wins :" to your language $txtlate = "Najnowsze wyniki ";// change "Latest High Score set by" to your language $txtwit = "wynik ";// change "with" to your language $txton = "on ";// change "on" to your language //******NOTHING TO EDIT BELOW HERE******************************************** global $scripturl,$sourcedir,$boardurl,$db_prefix,$modSettings,$settings; require_once($sourcedir.'/ArcadeDbConnector.php'); require_once($sourcedir.'/ArcadeStats.php'); echo '

Saloon gier
'; $random_games_choice = rand(1,4); $games_choice = 'games'.$random_games_choice; $curr_position = 0; $games_choice($no_games,$curr_position,$icons_per_row); Function games3($no,$curr_position,$icons_per_row) { global $scripturl,$db_prefix,$gamesUrl; //show the latest games echo '
Nowe gry
'; $sql = "SELECT ID_GAME, game_name, thumbnail, game_directory FROM {$db_prefix}arcade_games ORDER BY ID_GAME DESC , game_name ASC LIMIT 0,{$no}"; $result = db_query($sql,__FILE__,__LINE__); while($game = mysql_fetch_array($result)) { $game_thumb = !$game['game_directory'] ? $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail']; if($curr_position == $icons_per_row) { echo ''; $curr_position=0; } echo' '; $curr_position++; } mysql_free_result($result); echo '
'.$game['game_name'].'
'; } Function games1($no,$curr_position,$icons_per_row) { //show most played games (one score version only) global $scripturl,$db_prefix,$gamesUrl; echo '
Popularne
'; $sql = "SELECT ID_GAME, game_name, thumbnail, game_directory FROM {$db_prefix}arcade_games ORDER BY number_plays DESC , game_name ASC LIMIT 0,{$no}"; $result = db_query($sql,__FILE__,__LINE__); while($game = mysql_fetch_array($result)) { $game_thumb = !$game['game_directory'] ? $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail']; if($curr_position == $icons_per_row) { echo ''; $curr_position=0; } echo' '; $curr_position++; } mysql_free_result($result); echo '
'.$game['game_name'].'
'; } Function games4($no,$curr_position,$icons_per_row) { //show least played games (one score version only) global $scripturl,$db_prefix,$gamesUrl; echo '
Losowe gry
'; $sql = "SELECT ID_GAME, game_name, thumbnail, game_directory FROM {$db_prefix}arcade_games ORDER BY number_plays ASC , game_name ASC LIMIT 0,{$no}"; $result = db_query($sql,__FILE__,__LINE__); while($game = mysql_fetch_array($result)) { $game_thumb = !$game['game_directory'] ? $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail']; if($curr_position == $icons_per_row) { echo ''; $curr_position=0; } echo' '; $curr_position++; } mysql_free_result($result); echo '
'.$game['game_name'].'
'; } Function games2($no,$curr_position,$icons_per_row) { //show best rated games global $scripturl,$db_prefix,$gamesUrl; echo '
Top Rated
'; $sql = "SELECT ID_GAME, game_name, thumbnail, game_directory FROM {$db_prefix}arcade_games ORDER BY game_rating DESC , game_name ASC LIMIT 0,{$no}"; $result = db_query($sql,__FILE__,__LINE__); while($game = mysql_fetch_array($result)) { $game_thumb = !$game['game_directory'] ? $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail']; if($curr_position == $icons_per_row) { echo ''; $curr_position=0; } echo' '; $curr_position++; } mysql_free_result($result); echo '
'.$game['game_name'].'
'; } //Get newest champ or die $sql = "SELECT game.id_game, game.game_name, game.thumbnail, game.game_directory, IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, IFNULL(mem.realName,'') AS realName, score.score FROM {$db_prefix}arcade_scores AS score LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = score.id_member) JOIN {$db_prefix}arcade_games AS game ON (game.id_game = score.id_game) ORDER BY `champion_from` DESC LIMIT 0,1"; if(!($result = db_query($sql,__FILE__,__LINE__))) { die("Could not get the newest champ"); } $row = mysql_fetch_assoc($result); mysql_free_result($result); //newest champ details $playerid = $row['ID_MEMBER']; $player = $row['realName']; $game_id = $row['id_game']; $game_name = $row['game_name']; $score = round($row['score'], 3); $game_pic = !$row['game_directory'] ? $gamesUrl.$row['thumbnail'] : $gamesUrl.$row['game_directory']."/".$row['thumbnail']; $bp=ArcadeStats_BestPlayers($no_topten); $score_poss=0; //players position ?>
',$game_name,'
',$txtlate,'
',$player,'
',$txtwit,' ',$score,' ',$txton,'
',$game_name,'
------------------
',$txtplay,'

'; foreach ($bp as $out) { $score_poss++; echo '',$score_poss,' - ',$out['link'],'
',$txtwin,' ',$out['champions'],'

'; }; echo '
';