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

want to check server ip, to load plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lobopack23
Senior Member
Join Date: Jun 2009
Location: California , United Stat
Old 06-22-2012 , 16:59   want to check server ip, to load plugin
Reply With Quote #1

So from what I am aware of is that i need to use this

get_user_ip(0, SERVER_IP, 31)

I wanted to make a check where, if the server ip does not match the #define SERVER_IP, then the plugin will not run, and if it does plugin will run.

Any help?
__________________
- Steam: Lobopack23 - Link
Contact me if you need any help with Pokemod.
- 2nd Generation Pokemod - Link
(new skills, items, and pokemons)
- Buy Xp - Link
lobopack23 is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 06-22-2012 , 17:17   Re: want to check server ip, to load plugin
Reply With Quote #2

search. Asked and answered many times.
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 06-22-2012 , 17:45   Re: want to check server ip, to load plugin
Reply With Quote #3

Use this check in plugin_precache

PHP Code:
#define DEFINED_ADDRESS "1.1.1.1:27015"
new cName64 ]; get_cvar_string"net_address"cName63 );
if( 
equalcNameDEFINED_ADDRESS ) ) { /* Match */ } else { /* Does not match */ 
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-22-2012 , 17:50   Re: want to check server ip, to load plugin
Reply With Quote #4

Quote:
Originally Posted by claudiuhks View Post
Use this check in plugin_precache

PHP Code:
#define DEFINED_ADDRESS "1.1.1.1:27015"
new cName64 ]; get_cvar_string"net_address"cName63 );
if( 
equalcNameDEFINED_ADDRESS ) ) { /* Match */ } else { /* Does not match */ 
get_user_ip(0 is actually faster than get_cvar_string since it must search through the entire list of cvars until if finds the one you want (hence the reason why the use of pcvars is required in new plugin releases)
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
lobopack23
Senior Member
Join Date: Jun 2009
Location: California , United Stat
Old 06-23-2012 , 04:39   Re: want to check server ip, to load plugin
Reply With Quote #5

Ok but how would I actually check.. Like the condition?

Like this?

#define IPCHECK 1.1.1.1:27015
new serverip = get_user_ip(0, 0)

if( IPCHECK = serverip)
plugin_continue

Else
plugin_handled
__________________
- Steam: Lobopack23 - Link
Contact me if you need any help with Pokemod.
- 2nd Generation Pokemod - Link
(new skills, items, and pokemons)
- Buy Xp - Link
lobopack23 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-23-2012 , 04:49   Re: want to check server ip, to load plugin
Reply With Quote #6

Code:
new ip[22]; get_user_ip(0, ip, charsmax(ip), 0); if (!equal(ip, "1.1.1.1:27015"))     set_fail_state("Sorry, but your IP doesn't match my hardcoded IP"); else     server_print("Yay, your IP matches my hardcoded IP, enjoy");
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
lobopack23
Senior Member
Join Date: Jun 2009
Location: California , United Stat
Old 06-23-2012 , 05:04   Re: want to check server ip, to load plugin
Reply With Quote #7

Thx alot yami +rep
__________________
- Steam: Lobopack23 - Link
Contact me if you need any help with Pokemod.
- 2nd Generation Pokemod - Link
(new skills, items, and pokemons)
- Buy Xp - Link
lobopack23 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 01:10.


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