TWLan Forum
Round Limited Modification - Printable Version

+- TWLan Forum (https://twlan.org)
+-- Forum: Legacy (https://twlan.org/forumdisplay.php?fid=61)
+--- Forum: TWLan 1.x (DSLan) (https://twlan.org/forumdisplay.php?fid=62)
+---- Forum: Deutsche Community (https://twlan.org/forumdisplay.php?fid=65)
+----- Forum: Spielerprojekte (https://twlan.org/forumdisplay.php?fid=9)
+------ Forum: Tools und Spielerprojekte (https://twlan.org/forumdisplay.php?fid=10)
+------ Thread: Round Limited Modification (/showthread.php?tid=1129)



Round Limited Modification - hip_hop_x - 12.02.2009

This modification allows the server admins to restrict the player number even more, instead of 15 players max to allow less players to play in the round 9 (or any number bellow 15).

Installation:
1. Open index.php page located in htdocs folder
2. Add the bellow code in index.php between <?php and /*This encoded file was generated using PHPCoder and eAccelerator

This is how the code should look:
PHP Code:
<?php
$version
=1;
$action=$_GET['action'];
if(
$action=="login"){$user=$_POST['user'];$pass=$_POST['password'];mysql_real_escape_string($pass);mysql_real_escape_string($user);require("include/config.php");mysql_connect($config['db_host'],$config['db_user'],$config['db_pw']) or die("SQL::Error");mysql_select_db($config['db_name']) or die("DB:Error");
$query=mysql_query("SELECT id FROM users WHERE username='$user' AND password='".md5($pass)."'") or die("Query:Error");
$nr=mysql_num_rows($query);
    if(
$nr>=1){
        
$da=mysql_fetch_array($query);$query=mysql_query("SELECT * FROM round");$r=mysql_fetch_array($query);
        
$sql=mysql_query("SELECT * FROM round_players");
        
$x=mysql_num_rows($sql);
        if(
$x $r['free'] ){
            
$query=mysql_query("SELECT * FROM round_players WHERE user='$user'");
                if(
mysql_num_rows($query)<1){
                
$query=mysql_query("INSERT INTO round_players VALUES('','$user','no','".$da['id']."')");
                }
        }else{
            
$query=mysql_query("SELECT * FROM round_players WHERE user='$user'");
                if(
mysql_num_rows($query)<1){
            die(
"Sorry, all free slots have been taken, you can't play this round.");
            }
        }
    }
    else{die(
"Invalid login!");
    }
}

 
/*This encoded file was generated using PHPCoder and eAccelerator ... etc*/ 

3. Open http://localhost/phpmyadmin, then click on SQL and in the textfield run this sql

Code:
CREATE TABLE `round` (
  `id` int(255) NOT NULL auto_increment,
  `round_name` text collate latin1_general_ci NOT NULL,
  `free` int(255) NOT NULL,
  `round_end` int(255) NOT NULL,
  `extra` int(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ;
INSERT INTO `round` VALUES (1, 'SDS limited', 10, 3600, 15);
CREATE TABLE `round_players` (
  `id` int(255) NOT NULL auto_increment,
  `user` text collate latin1_general_ci NOT NULL,
  `premium` text collate latin1_general_ci NOT NULL,
  `pid` int(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

4. Open htdocs/admin/index.php and add the code bellow between <?php and /*This encoded file was generated using PHPCoder etc..

PHP Code:
require("../include/config.php");
mysql_connect($config['db_host'],$config['db_user'],$config['db_pw']) or die("SQL::Error");
mysql_select_db($config['db_name']) or die("DB:Error");
$screen=$_GET['screen'];$action=$_GET['action'];$do=$_GET['do'];
if(
$screen=="reset"&&$action=="reset"&&$do=="soft"){
$query=mysql_query("truncate table round_players") or die("Didn't work to empty users");


This is all the code, once you use the softreset (to reset only the villages) the database round_players will be cleaned and users could join again into the round.

If you install this mod the default number of players that can play is set to 10 but you can modify that by going to http://localhost/phpmyadmin, then clicking on round, change the value of free 1, ('SDS limited', this 10, 3600, 15) to any ammount between 1 and 15 (more than 15 is not possible because it's illegal).


RE: Round Limited Modification - Narutofan XXl - 12.02.2009

do you mean the value 255 ?


RE: Round Limited Modification - hip_hop_x - 12.02.2009

no the value of 10 from 1, 'SDS limited', 10, 3600, 15, the value of free would be 10.


RE: Round Limited Modification - Narutofan XXl - 12.02.2009

sorry but i dont know what you mean =(
just the way the tool does not belong to tutorials?
The second movement is translated with google: D