Raised This Month: $ Target: $400
 0% 

match for IP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Salmus
Junior Member
Join Date: Dec 2007
Old 03-30-2009 , 09:15   match for IP
Reply With Quote #1

Hello !

I'm trying to create a plugin for my community only, and I want to match for IP (listen) to protect my work against leechers or non-community members.

I'm thinking about:

new serverip;
serverip = get_cvar_pointer(ip);


But if I echo it, server dies ... I'm thinking about something like (php code)


$mainclass = "66.66.66";
$serverip = get_cvar_pointer(ip);

$serveripEXPLODE = explode(".", $serverip");
$serveripDONE = $serveripEXPLODE[0] . "." . $serveripEXPLODE[1] . "." . $serveripEXPLODE[2];

if(!$serveripDONE==$serverip) {
server_cmd("quit");
}
else {
[...]
}


So, if user doesn't have system CVAR IP containing "66.66.66" then it will kill the server

Thank you in advance !
Salmus is offline
iNspiratioN
Member
Join Date: Feb 2009
Location: Lithuania
Old 03-30-2009 , 09:49   Re: match for IP
Reply With Quote #2

This is AMXX Scripting Forum not PHP isnt it?
__________________
iNspiratioN is offline
Salmus
Junior Member
Join Date: Dec 2007
Old 03-30-2009 , 10:06   Re: match for IP
Reply With Quote #3

You're right, but ... trying to learn ...


I did something like this:

#include <amxmodx>
new serverip[64];
[...]
get_cvar_string("ip",serverip,63);
[...]
client_print(id, "ServerIPCVAR %s", serverip);

but:
home/groups/amxmodx/tmp3/text7p4iyD.sma(44) : error 035: argument type mismatch (argument 2) ...
Salmus is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 03-30-2009 , 11:19   Re: match for IP
Reply With Quote #4

Display the whole code.

Also, get_cvar_string("ip",serverip,63)

Why do you wrap ip in quotes?

:/
BOYSplayCS is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-30-2009 , 21:24   Re: match for IP
Reply With Quote #5

Quote:
Originally Posted by BOYSplayCS View Post
Display the whole code.

Also, get_cvar_string("ip",serverip,63)

Why do you wrap ip in quotes?

:/
Because it's a cvar name and not a pointer.
__________________
fysiks is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 03-31-2009 , 06:36   Re: match for IP
Reply With Quote #6

Ah, didn't notice that at first glance. Thanks for the explanation.
BOYSplayCS is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 03-31-2009 , 13:29   Re: match for IP
Reply With Quote #7

haha you can hex that out in a second sorry :-/
Styles is offline
Send a message via AIM to Styles
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 03-31-2009 , 14:04   Re: match for IP
Reply With Quote #8

Quote:
Originally Posted by Salmus View Post
You're right, but ... trying to learn ...


I did something like this:

#include <amxmodx>
new serverip[64];
[...]
get_cvar_string("ip",serverip,63);
[...]
client_print(id, "ServerIPCVAR %s", serverip);

but:
home/groups/amxmodx/tmp3/text7p4iyD.sma(44) : error 035: argument type mismatch (argument 2) ...
You forgot to specify the type of print in the 2nd argument. The string is the 3rd argument.
Code:
enum {         print_notify = 1,         print_console,         print_chat,         print_center, };   native client_print(index,type,const message[],any:...);
__________________
hleV is offline
Speed!
BANNED
Join Date: Jan 2009
Old 03-31-2009 , 14:29   Re: match for IP
Reply With Quote #9

Quote:
Originally Posted by hleV View Post
You forgot to specify the type of print in the 2nd argument. The string is the 3rd argument.
Code:
enum {         print_notify = 1,         print_console,         print_chat,         print_center, };   native client_print(index,type,const message[],any:...);
offtopic: which is print_notify :\ I've never saw it LOL
Speed! is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-31-2009 , 14:37   Re: match for IP
Reply With Quote #10

If you are using "developer 1", you will notice that your console is shown in the top left of your screen.
print_notify prints messages in that same section (not sure if it goes to your console, but I'd assume it does).
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 08:57.


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