simple use steamworks extensions
REQUIRE
SteamWorks
PHP Code:
#pragma semicolon 1
#include <sourcemod>
//#undef REQUIRE_EXTENSIONS
#include <SteamWorks>
//#define REQUIRE_EXTENSIONS
int ipaddr[4];
char port[8],ipport[64];
bool IP = false;
public Plugin myinfo =
{
name = "New Plugin",
author = "bbs.93x.net",
description = "<- Description ->",
version = "1.0",
url = "<- URL ->"
}
//#if defined REQUIRE_EXTENSIONS
public int SteamWorks_SteamServersConnected()
{
if(!IP)
{
if ((GetFeatureStatus(FeatureType_Native, "SteamWorks_GetPublicIP") == FeatureStatus_Available))
PrintToServer("SteamWorks is Available!");
if(SteamWorks_GetPublicIP(ipaddr))
{
IP = true;
GetConVarString(FindConVar("hostport"), port, sizeof(port));
Format(ipport,sizeof(ipport),"%i.%i.%i.%i:%s" ,ipaddr[0],ipaddr[1],ipaddr[2],ipaddr[3],port);
if(StrContains(ipport,"1.1.1.1:27015") == -1)
{
SetFailState("The plugin isn't running on allowed IP address");
}
}
else
{
PrintToServer("Get Server Public IP Faild!");
SetFailState("Get Server Public IP Faild!");
}
}
}
//#endif
__________________