rejetto forum

Please help me to correct this Event script.

Novox · 8 · 2994

0 Members and 1 Guest are viewing this topic.

Offline Novox

  • Occasional poster
  • *
    • Posts: 84
    • View Profile
Here is my event script use to limit 3 connections per user per file. Unfortunately, the script is doesn't work. User can connect more than 3 connection

This is what I read from HFS document

Quote
current downloads of file
    number of current downloads of current file.
    If an unnamed optional parameter is specified, it is used as IP mask, and only matching connections will be counted.
    If the parameter is given name user, only connections by such user will be counted.

Here is my code

Code: [Select]
[download]
{.if| {.{.current downloads of file.} > 3.} |{: {.disconnect.} :} .}

What wrong with my code? and how can i given a name user parameter in the script?

Thank you very much!

Tested on HFS beta #260
« Last Edit: July 14, 2010, 04:06:59 PM by Novox »


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
{.current downloads of file.}

this macro doesn't exist  ;D

[download]
{.if|{.{.current downloads|ip=%ip%|file=this.} > 3.} |{: {.disconnect.} :}/if.}


or you can limit the number of connection by ip, in the menu limits  ;)

list of macros http://www.rejetto.com/wiki/index.php/HFS:_scripting_commands
list of events http://www.rejetto.com/forum/index.php/topic,6845.msg1042396.html#msg1042396
« Last Edit: July 14, 2010, 10:03:05 PM by Mars »


Offline Novox

  • Occasional poster
  • *
    • Posts: 84
    • View Profile
Thank you very much for your reply.

However, the script is doesn't work for me. I have tried to replace IP parameter to user but it still doesn't work.

Code: [Select]
[download]
{.if|{.{.current downloads|user=%user%|file=this.} > 3.} |{: {.disconnect.} :}/if.}

The users in my server can still connecting and downloading file in HFS with more than 3 connection per file by using IDM. How can I set the connection per file from the HFS menu?

I have found that limit connection in HFS menu is global connections right? All I need is to limit 3 connections per file but they still get more connection if they download a new file.

Please advice :)


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
It will be necessary to wait for the answer of rejetto to this subject, it is better able to determine the relation with the limits and the number of current connections.

do a test with

[download]
{.if|{.{.current downloads|ip=%ip%.} > 3.} |{: {.disconnect.} :}/if.}

inside the macro file=this is removed
« Last Edit: July 16, 2010, 11:49:31 AM by Mars »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
i tested the script and it worked fine here

[+download]
{.if|{.{.current downloads|ip=%ip%|file=this.} > 3.} |{: {.disconnection reason|too many threads.} :}/if.}


i advice to use {.disconnection reason.} in place of {.disconnect.}

All I need is to limit 3 connections per file but they still get more connection if they download a new file.

it's not clear what you are saying, "new file".
being the limit applied to a single file, any file is not affecting others.
if you download 2 files you'll have 3 + 3 available connections from the same IP address.


Offline Novox

  • Occasional poster
  • *
    • Posts: 84
    • View Profile
Quote
being the limit applied to a single file, any file is not affecting others.
if you download 2 files you'll have 3 + 3 available connections from the same IP address.

What you said, is what I want.  ;D

do I need to add + sign in front if download? [+download]? what is it?


Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1298
  • ....... chut ! shh!
    • View Profile

do I need to add + sign in front if download? [+download]? what is it?

Yes, especially if you already have a section [download] or [+download]

It's so that all sections can be executed.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
i consider it a good practice, in case you have other scripts relying on that event/section.
in the future it will be a must, when i'll implement plugin system.