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

Plugin only work on server ip adress


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Huczus
New Member
Join Date: Aug 2016
Old 05-05-2017 , 16:59   Plugin only work on server ip adress
Reply With Quote #1

Hello,
at the beginning im sorry for my bad english.

I `d like to ask how to make the plugin work only for my server's ip ?
Huczus is offline
RumbleFrog
Great Tester of Whatever
Join Date: Dec 2016
Location: Fish Tank
Old 05-05-2017 , 17:07   Re: Plugin only work on server ip adress
Reply With Quote #2

PHP Code:
char g_IP[64];

int ip GetConVarInt(FindConVar("hostip"));
Format(g_IPsizeof(g_IP), "%d.%d.%d.%d", ((ip 0xFF000000) >> 24) & 0xFF, ((ip 0x00FF0000) >> 16) & 0xFF, ((ip 0x0000FF00) >>  8) & 0xFF, ((ip 0x000000FF) >>  0) & 0xFF);

if (!
StrEqual("Your.IP.Here"g_IP))
{
    
SetFailState("Heh");

IP obtained through Steamworks/SteamTools is more reliable.

Last edited by RumbleFrog; 05-05-2017 at 17:09.
RumbleFrog is offline
Huczus
New Member
Join Date: Aug 2016
Old 05-05-2017 , 17:17   Re: Plugin only work on server ip adress
Reply With Quote #3

I should add this to frorward OnPluginStart ?

@edit its work thank you very much !!!!, and how to add port now?

Last edited by Huczus; 05-05-2017 at 17:36.
Huczus is offline
RumbleFrog
Great Tester of Whatever
Join Date: Dec 2016
Location: Fish Tank
Old 05-05-2017 , 19:25   Re: Plugin only work on server ip adress
Reply With Quote #4

Port Version:

PHP Code:
char g_IP[64];

int ip GetConVarInt(FindConVar("hostip"));
Format(g_IPsizeof(g_IP), "%d.%d.%d.%d:%d", ((ip 0xFF000000) >> 24) & 0xFF, ((ip 0x00FF0000) >> 16) & 0xFF, ((ip 0x0000FF00) >>  8) & 0xFF, ((ip 0x000000FF) >>  0) & 0xFFGetConVarInt(FindConVar("hostport")));

if (!
StrEqual("Your.IP.Here:Port"g_IP))
{
    
SetFailState("Heh");

RumbleFrog is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 05-06-2017 , 06:41   Re: Plugin only work on server ip adress
Reply With Quote #5

If you will not share source codes with customers, this is forbidden. Be your knowledge.
__________________
vortex. is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-08-2017 , 00:38   Re: Plugin only work on server ip adress
Reply With Quote #6

To iterate.

You must provide sourcecode when you distribute a plugin. This means who you give it to can remove this code and redistribute the new version.

Even if you rent a server with the plugin installed and dont give access to the .smx

You must provide source.
__________________
Neuro Toxin 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 15:11.


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