Quote:
Originally Posted by BAILANDO
As Neuro Toxin say, better is SetFailState,
Spoiler
Code:
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR "BailaRazor"
#define PLUGIN_VERSION "1.00"
//#include <sourcemod>
//#include <sdktools>
//#include <cstrike>
//#include <sdkhooks>
static char ip[30];
public Plugin myinfo =
{
name = "Run plugin only on specific IP",
author = PLUGIN_AUTHOR,
description = "Run plugin only on specific IP",
version = PLUGIN_VERSION,
url = ""
};
public void OnPluginStart()
{
static Handle conip = INVALID_HANDLE;
conip = FindConVar("hostip");
GetConVarString(conip, ip, 30);
SomeAction();
}
public void SomeAction()
{
//Run only when IP is 1.1.1.1
if (StrEqual(ip, "1.1.1.1"))
{
PrintToChatAll("Server IP is 1.1.1.1 and plugin is loaded");
}
else
{
PrintToChatAll("Server IP isn't 1.1.1.1 and plugins is unloaded");
SetFailState("Server isn't running on allowed IP address");
}
}
//Here you can put your own code, plugin can access this code only when server running on 1.1.1.1, else it will be on fail state "unloaded"
|
Many thanks man, you're a good guy that actually understands what i am talking about and doesn't fill up the thread with nothingness, some bacon for you my good sir
There seems to be a problem however with Source that makes the plugin not work.
When writing hostip in console (server or client) the server IP will not be displayed.
I've tested writing hostip in multiple games now to see what will happen, none of them will print out the hostip.
DOD says: "hostip" = "-1062731419"
TF2 says: "hostip" = "-1062731566"
HL2DM says: "hostip" = "-1135168212"
So the plugin is still not working unfortunately, but we're getting close ! lol.