09 Max Leech/Seed Slots By pdq

Started by Mindless, July 21, 2012, 09:53:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BamBam0077

#11
wrong section...
"When Darkness Shadows Your Doubts, Deep Within Us Is Our Key, Not Success But Everything" ~ Anonymous

denede

you asked this on the other forum... you going to keep asking on every forum instead of looking at the query where you get the error and fix it?

Black

Sorry for bump this topic

I try this mod and I get back this error "Tracker error 5" Whats going wrong here :O

Payaa

#8
I solved it thx! :)

autotron

Quote from: Payaa on November 22, 2012, 07:51:12 PM
I defined it, but in bittorrent.php. But I think not that the problem.

If your not going to install the mod as directed properly the why come here asking for help when it does not work?

If your not going to install as posted which is tried and tested then don't come here crying it don't work.

Payaa

#6
I know what this mod do :)
I use like this:

///slotsystem
if ($CURUSER['class'] < UC_UPLOADER /*&& $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_USER:
$max = 3;
break;
case UC_POWER_USER:
$max = 7;
break;
default:
  $max = 99;
  }
    }   
    else
    $max = 999;


I dont use ratio thing :) I tried with the full code like the first post, but the same thing without uncomment the $TBDEV thing all class shows 999 :(

xamalis

huh this is what mod do!!
If you have on (max_slots=1) slots... then all users >= vip have got 999 (unlimited)slots else slots defined by ratio and class!

Payaa

I defined it, but in bittorrent.php. But I think not that the problem.

xamalis

Yeah you have to define
$TBDEV['max_slots'] = 1//1=On 0=Off
@ config.php  ;)

Payaa

Thx bro :)

Anyway I wonder if I put this in bittorrent:
if ($CURUSER['class'] < UC_VIP && $TBDEV['max_slots']) {
the statusbar shows 999 for every class, but if I put just this:
if ($CURUSER['class'] < UC_VIP) {
then its shows the correct values.

Anybody know why?
Thx!

Mindless

Credits to pdq

in announce.php replace:

Code (php) Select
define ('UC_VIP', 2);

with:

Code (php) Select
$TBDEV['max_slots'] = 1; //1=On 0=Off
define ('UC_USER', 0);
define ('UC_POWER_USER', 1);
define ('UC_VIP', 2);


then find this:

Code (php) Select
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:

Code (php) Select
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:

Code (php) Select
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:

Code (php) Select
"&nbsp;&nbsp;<img alt='{$lang['gl_leech_torrents']}' title='{$lang['gl_leech_torrents']}' src='pic/arrowdown.gif' />&nbsp;{$seedleech['no']}</div>".

change them to like: (updated)

Code (php) Select
"&nbsp;&nbsp;<img alt='{$lang['gl_leech_torrents']}' title='{$lang['gl_leech_torrents']}' src='pic/arrowdown.gif' />&nbsp;".($TBDEV['max_slots'] ? "<a title='I have ".$max." Download Slots'>{$seedleech['no']}/".$max."</a>" : $seedleech['no'])."</div>".

Code (php) Select
"&nbsp;&nbsp;<img alt='{$lang['gl_leech_torrents']}' title='{$lang['gl_leech_torrents']}' src='{$TBDEV['pic_base_url']}dl.png' />&nbsp;".($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

Code (php) Select
$TBDEV['max_slots'] = 1; // 1=On 0=Off

=]