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

Solved set sv_downloadurl to server ip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 01-12-2023 , 04:04   set sv_downloadurl to server ip
Reply With Quote #1

how do I set sv_downloadurl cvar to server ip on plugin load?

Last edited by AuricYoutube; 01-16-2023 at 13:28.
AuricYoutube is offline
oqyh
Senior Member
Join Date: May 2019
Location: United Arab Emirates
Old 01-12-2023 , 05:41   Re: set sv_downloadurl to server ip
Reply With Quote #2

PHP Code:
#include <sourcemod>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
FindConVar("sv_allowupload").SetInt(0);    //Set sv_allowupload 0
    
FindConVar("sv_allowdownload").SetInt(1);    //Set sv_allowupload 1
    
FindConVar("sv_downloadurl").SetString("https://fastdl.com/csgo"); //Set String Your FastDL

__________________
.:[ >> My Plugins << ]:.

My discord : oqyh
oqyh is offline
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 01-12-2023 , 15:31   Re: set sv_downloadurl to server ip
Reply With Quote #3

Quote:
Originally Posted by oqyh View Post
PHP Code:
#include <sourcemod>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
FindConVar("sv_allowupload").SetInt(0);    //Set sv_allowupload 0
    
FindConVar("sv_allowdownload").SetInt(1);    //Set sv_allowupload 1
    
FindConVar("sv_downloadurl").SetString("https://fastdl.com/csgo"); //Set String Your FastDL


I meant for the plugin to grab the server ip from the server by itself not hardcoded
AuricYoutube is offline
ProjectSky
AlliedModders Donor
Join Date: Aug 2020
Old 01-15-2023 , 09:48   Re: set sv_downloadurl to server ip
Reply With Quote #4

need SteamWorks

PHP Code:
#include <sourcemod>
#include <SteamWorks>

ConVar
g_hSvDownloadUrl
;

public 
void OnPluginStart()
{
    
g_hSvDownloadUrl FindConVar("sv_downloadurl");
}

public 
void OnConfigsExecuted()
{
    
char sUrl[64];
    
int ipaddr[4];

    
SteamWorks_GetPublicIP(ipaddr);
    
FormatEx(sUrlsizeof(sUrl), "http://%d.%d.%d.%d"ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]);

    
g_hSvDownloadUrl.SetString(sUrl);

not test, should work
ProjectSky is offline
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 01-16-2023 , 13:28   Re: set sv_downloadurl to server ip
Reply With Quote #5

Thank you it works
AuricYoutube is offline
Reply


Thread Tools
Display Modes

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 01:13.


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