Chez |
27th February 2013 10:21 |
Max Leech/Seed Slots
Attention
This mod is for 09 version!
Credits to pdq
in announce.php replace:
with:
PHP Code:
$TBDEV['max_slots'] = 1; //1=On 0=Off
define ('UC_USER', 0);
define ('UC_POWER_USER', 1);
define ('UC_VIP', 2);
then find this:
PHP Code:
if ($left > 0 && $user['class'] < UC_VIP && $TBDEV['user_ratios'])
{
$gigs = $user["uploaded"] / (1024*1024*1024);
$elapsed = floor((time() - $torrent["ts"]) / 3600);
$ratio = (($user["downloaded"] > 0) ? ($user["uploaded"] / $user["downloaded"]) : 1);
if ($ratio < 0.5 || $gigs < 5) $wait = 48;
elseif ($ratio < 0.65 || $gigs < 6.5) $wait = 24;
elseif ($ratio < 0.8 || $gigs < 8) $wait = 12;
elseif ($ratio < 0.95 || $gigs < 9.5) $wait = 6;
else $wait = 0;
if ($elapsed < $wait)
err("Not authorized (" . ($wait - $elapsed) . "h) - READ THE FAQ!");
}
replace with:
PHP Code:
if ($left > 0 && $user['class'] < UC_VIP) {
$ratio = (($user["downloaded"] > 0) ? ($user["uploaded"] / $user["downloaded"]) : 1);
if ($TBDEV['user_ratios']) {
$gigs = $user["uploaded"] / (1024*1024*1024);
$elapsed = floor((time() - $torrent["ts"]) / 3600);
if ($ratio < 0.5 || $gigs < 5) $wait = 48;
elseif ($ratio < 0.65 || $gigs < 6.5) $wait = 24;
elseif ($ratio < 0.8 || $gigs < 8) $wait = 12;
elseif ($ratio < 0.95 || $gigs < 9.5) $wait = 6;
else $wait = 0;
if ($elapsed < $wait)
err("Not authorized (" . ($wait - $elapsed) . "h) - READ THE FAQ!");
}
if ($TBDEV['max_slots']) {
if ($ratio < 0.95) {
switch (true) {
case ($ratio < 0.5):
$max = 2;
break;
case ($ratio < 0.65):
$max = 3;
break;
case ($ratio < 0.8):
$max = 5;
break;
case ($ratio < 0.95):
$max = 10;
break;
default:
$max = 10;
}
}
else {
switch ($user['class']) {
// case UC_LEECH:
// $max = 10;
// break;
case UC_USER:
$max = 20;
break;
case UC_POWER_USER:
$max = 30;
break;
// case UC_X_POWER_USER:
// $max = 50;
// break;
// case UC_COMM_STAFF:
// $max = 50;
// break;
// default:
$max = 99;
}
}
if ($max > 0) {
$res = mysql_query("SELECT COUNT(*) AS num FROM peers WHERE userid='$userid' AND seeder='no'") or err("Tracker error 5");
$row = mysql_fetch_assoc($res);
if ($row['num'] >= $max)
err("Access denied (Torrents Limit exceeded - $max) See FAQ!");
}
}
}
in bittorrent.php within your StatusBar() function find:
////////////// REP SYSTEM END //////////
add this below:
PHP Code:
if ($CURUSER['class'] < UC_VIP && $TBDEV['max_slots']) {
$ratioq = (($CURUSER['downloaded'] > 0) ? ($CURUSER['uploaded'] / $CURUSER['downloaded']) : 1);
if ($ratioq < 0.95) {
switch (true) {
case ($ratioq < 0.5):
$max = 2;
break;
case ($ratioq < 0.65):
$max = 3;
break;
case ($ratioq < 0.8):
$max = 5;
break;
case ($ratioq < 0.95):
$max = 10;
break;
default:
$max = 10;
}
}
else {
switch ($CURUSER['class']) {
// case UC_LEECH:
// $max = 10;
// break;
case UC_USER:
$max = 20;
break;
case UC_POWER_USER:
$max = 30;
break;
// case UC_X_POWER_USER:
// $max = 50;
// break;
// case UC_COMM_STAFF:
// $max = 50;
// break;
default:
$max = 99;
}
}
}
else
$max = 999;
now find these lines:
PHP Code:
" <img alt='{$lang['gl_leech_torrents']}' title='{$lang['gl_leech_torrents']}' src='pic/arrowdown.gif' /> {$seedleech['no']}</div>".
change them to like: (updated)
PHP Code:
" <img alt='{$lang['gl_leech_torrents']}' title='{$lang['gl_leech_torrents']}' src='pic/arrowdown.gif' /> ".($TBDEV['max_slots'] ? "<a title='I have ".$max." Download Slots'>{$seedleech['no']}/".$max."</a>" : $seedleech['no'])."</div>".
PHP Code:
" <img alt='{$lang['gl_leech_torrents']}' title='{$lang['gl_leech_torrents']}' src='{$TBDEV['pic_base_url']}dl.png' /> ".($TBDEV['max_slots'] ? "<a title='I have ".$max." Download Slots'>{$seed['no']}/".$max."</a>" : $seed['no'])."</div>".
and don't forget to add in config.php
PHP Code:
$TBDEV['max_slots'] = 1; // 1=On 0=Off
|