Raised This Month: $51 Target: $400
 12% 

3 or 4 sv_downloadurl


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cezars
Member
Join Date: May 2009
Location: Romania
Old 05-15-2009 , 08:13   3 or 4 sv_downloadurl
Reply With Quote #1

Can anyone make a plugin to use more the 1 sv_downloadurl ?it can be done ? if someone can that will be great couse some of the ftps are limited no more then 1 gb or .... pls drop me a link if someone can do this
cezars is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-15-2009 , 08:24   Re: 3 or 4 sv_downloadurl
Reply With Quote #2

You could make a plugin that cycles through a list of download URLs; the game does not support using more than 1 at a time. Perhaps to avoid the bandwidth limit, you could cycle to the next download URL after X clients connect to the server.

If you are interested I can write this up for you.
__________________
Bugsy is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 05-15-2009 , 08:40   Re: 3 or 4 sv_downloadurl
Reply With Quote #3

im interested too
KadiR is offline
koleos
Senior Member
Join Date: Jul 2008
Old 05-15-2009 , 14:00   Re: 3 or 4 sv_downloadurl
Reply With Quote #4

Same here
koleos is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-15-2009 , 17:21   Re: 3 or 4 sv_downloadurl
Reply With Quote #5

I have this amx plugin :

Basically, you have to store all default files on all urls (plugins models/sprites/sounds), but you can dispatch maps (and attachments) files on specific url?
Code have to be ported to amxx.
May be this event could be replaced with plugin_end() forward

PHP Code:
#include <amxmod>

public plugin_init() 
{
    
register_plugin("Download URL""0.1""KRoT@L")
    
register_event"30" "changeMap""a" )
}

public 
changeMap()
{
    new 
nextmap[32], filename[128], text[128]
    
get_cvar_string("amx_nextmap"nextmap31)
    
format(filename127"addons/amx/config/maps/%s.cfg"nextmap)
    new 
len0
    
if(file_exists(filename))
    { 
        while(
read_file(filename,i++,text,127,len))
        {
            if(
containi(text"sv_downloadurl") != -1)
            {
                new var[
64], downloadurl[128]
                
parse(text, var, 63downloadurl127)
                
set_cvar_string("sv_downloadurl"downloadurl)
                return 
PLUGIN_CONTINUE
            
}
        }
    }

    return 
PLUGIN_CONTINUE

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-15-2009 , 19:00   Re: 3 or 4 sv_downloadurl
Reply With Quote #6

This will load your URLs from a file and then rotate through the list.

Example:

Suppose you have 3 download URLs in the file. For this example I will use 10 as the connecting player number at which we will rotate to the next URL. You can change this by setting the cvar downloadurl_rotate to the appropriate number.

Code:
Server start\map-change, all URLs get loaded from file, sv_downloadurl set to URL1
When the 10th player connects to server, sv_downloadurl gets set to URL2
When the 10th player connects to server, sv_downloadurl gets set to URL3
When the 10th player connects to server, sv_downloadurl gets set to URL1
When the 10th player connects to server, sv_downloadurl gets set to URL2
When the 10th player connects to server, sv_downloadurl gets set to URL3
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN    "sv_downloadurl Rotator"
#define VERSION    "1.0"
#define AUTHOR    "bugsy"

#define MAX_URLS    10
#define MAX_SIZE    64

/* Create file [addons/amxmodx/configs/downloadurls.txt] with the URLs in below format:

http://www.theurl.net/whatever/
http://www.thenexturl.org/location/of/files/
http://www.anotherurl.net/~hi/

Currently the plugin supports 10 URLs but you can increase this if you want.*/
    
new g_iNumberConnections = -1;        //Connection counter for current URL
new g_iCurrentURL;            //Current URL index of g_szURL

new g_szURL[MAX_URLS][MAX_SIZE];    //Array of URLs loaded from file
new g_iNumURL;                //Number of URLs loaded from file

new g_pDownloadURL            //CVar pointer for sv_downloadurl
new g_pURLRotate;            //CVar specifying at how many connections to move to next URL
new g_pEnabled;                //CVar to enable\disable. If no URLs are loaded from file the plugin will
                    //automatically disable itself.

new const g_szURLFile[] = "addons/amxmodx/configs/downloadurls.txt";

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
g_pDownloadURL get_cvar_pointer"sv_downloadurl" );
    
g_pURLRotate register_cvar"downloadurl_rotate" "10" );
    
g_pEnabled register_cvar(" downloadurl_enable" "1" );
}

public 
plugin_cfg()
{
    
g_iNumURL ReadURL();
    
    if ( 
g_iNumURL > -)
        
set_pcvar_stringg_pDownloadURL g_szURLg_iCurrentURL ] );
    else
        
set_pcvar_stringg_pEnabled "0" );
}

public 
client_connect(id)
{
    if ( !
get_pcvar_numg_pEnabled ) || is_user_botid ) )
        return 
PLUGIN_CONTINUE;
        
    if ( ++
g_iNumberConnections >= get_pcvar_numg_pURLRotate ) )
    {
        if ( ++
g_iCurrentURL g_iNumURL )
            
g_iCurrentURL 0;
            
        
set_pcvar_stringg_pDownloadURL g_szURLg_iCurrentURL ] );
        
        
g_iNumberConnections 0;
    }
    
    return 
PLUGIN_CONTINUE;
}
        
public 
ReadURL()
{
    if ( !
file_existsg_szURLFile ) )
        return -
1;
        
    new 
iHandle fopeng_szURLFile "rt" );
    new 
iURL = -1;
    new 
iLen;
    
    if ( !
iHandle )
        return -
1;
    
    while ( !
feofiHandle ) )
    {
        
iLen fgets iHandle g_szURL[ ++iURL ] , MAX_SIZE );
        
        
//Skip line-items that begin with a space or new line
        
if ( !iLen || ( g_szURLiURL ][ ] == ' ' ) || ( g_szURLiURL ][ ] == '^n' ) )
            
g_szURLiURL-- ][ ] = 0;
        else if ( 
g_szURLiURL ][ iLen-] == '^n' )
            
g_szURLiURL ][ iLen-] = 0;
    }
    
    
fcloseiHandle );
    
    return 
iURL;

__________________

Last edited by Bugsy; 05-15-2009 at 19:27.
Bugsy is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-15-2009 , 19:23   Re: 3 or 4 sv_downloadurl
Reply With Quote #7

I don't think he wants few urls because of limited traffic, but because of the place he has on ftps.

I think there's a tip to do to redirect 1st url to 2nd one if a requested file is not on the first one (with apache ?)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-15-2009 , 19:25   Re: 3 or 4 sv_downloadurl
Reply With Quote #8

@Bugsy
Code:
public plugin_cfg() {     g_iNumURL = ReadURL();         if ( g_iNumURL )         set_pcvar_string( g_pDownloadURL , g_szURL[ g_iCurrentURL ] );     else         set_pcvar_string( g_pEnabled , "0" ); }
Should be:
Code:
public plugin_cfg() {     g_iNumURL = ReadURL();    
    if ( g_iNumURL > 0 )
        set_pcvar_string( g_pDownloadURL , g_szURL[ g_iCurrentURL ] );     else         set_pcvar_string( g_pEnabled , "0" ); }
Because ReadUrl() can return -1 if the file exists but is empty.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-15-2009 , 19:26   Re: 3 or 4 sv_downloadurl
Reply With Quote #9

What I ascertained out of his post\request is he is trying to avoid excessive bandwidth usage on a single URL and would like to use multiple URLs so one does not get over-used.

Edit: Thx Exolent
__________________
Bugsy is offline
cezars
Member
Join Date: May 2009
Location: Romania
Old 05-16-2009 , 09:00   Re: 3 or 4 sv_downloadurl
Reply With Quote #10

many thx to all for enswer so fast is not abbout avoid bandwidth usage its abbout space on ftps i have 5gb of maps and other stuff moust of the host dont have more then 1gb space and i need to put 800mb -1gb maps and stuf to each host and if 1 host dont have that maps that i change to go to next one

Last edited by cezars; 05-16-2009 at 09:04.
cezars is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode