AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how do i look up ips ? (https://forums.alliedmods.net/showthread.php?t=45555)

djh 10-05-2006 18:26

how do i look up ips ?
 
we have the get_user_ip(id,[...]) etc
how can i lookup the address like the command host does in linux or nslookup in windows ?

nightscreem 10-05-2006 18:39

Re: how do i look up ips ?
 
you mean get_user_ip(index,ip[],len, without_port = 0);
example
new ip[32]
get_user_ip(id ,ip,32, 0);

teame06 10-05-2006 20:13

Re: how do i look up ips ?
 
Code:
get_user_ip(id ,ip,32, 1); // Last arugment need to be 1 if you want it without the port. // For example // 192.168.2.4:27015 is what you will get if you use the last arugment with 0 or don't even put a number there. // 192.168.2.4 is what you will get if you put 1 as the last arugment.

Xanimos 10-05-2006 22:44

Re: how do i look up ips ?
 
No, he means the full version. (Like you see in IRC) with the host and whatnot.
The answer to that is that it can't be done. You can only get the IP.

djh 10-07-2006 06:31

Re: how do i look up ips ?
 
thanx xanimos.
note: some ppl just don't like reading the fist post :)

now comes *THE* part
has it been done before using custom made modules ? :) (ofc now everybody reads this and everybody will tell me to search-> http://forums.alliedmods.net/showthr...ostname+lookup lovely ain't it ?)

XxAvalanchexX 10-07-2006 21:12

Re: how do i look up ips ?
 
I think the best you can do is get the country the IP address is from, using the GeoIP module.

djh 10-12-2006 16:49

Re: how do i look up ips ?
 
well i've been through parts of the sockets module source code but i don't understand it. not yet anyway
this however rang a bell :
Code:

// Test the hostname, and resolve if needed
    if ((addr = inet_addr(hostname)) != INADDR_NONE) {
        // seems like hostname is a numeric ip, so put it into the structure
        memcpy( (char *)&server.sin_addr, &addr, sizeof(addr));
    }
    else {
        // hostname is a domain, so resolve it to an ip
        host_info = gethostbyname(hostname);
        if (host_info == NULL) {
[...]

as i said i don't understand much and i don't have a compiler to compile modules so maybe in the next relase you guys will add a function in the sockets module so that by adding "#include <sockets>" in my sma file i will be able to use let's say
Code:
new ip[32],hname[64] get_user_ip(id,ip,32,0) get_hostname(ip,hname,63)
etc etc :) one way or another it will be done, because i have friends that are well-versed in coding, but of course it's better to have it built-in amxx so that everyone can use it whenever they wish

just so that anyone wonders what's all this fuss about ?
ppl often get banned when playing from icaffes because of - cheating -. now icaffe owners don't afford to get their icaffe accounts vac-banned so obviousely there's no cheat, it just so happens that the player has good skills and with the right hardware he's simply owning.
i've modified enough to show a console-outpout containing the user the ip and his access, but if i had a "hostname" ie pc55.l337-caffe.city.providername.com standing after each user name then well.. he/she wouldn't get banned for cheating now would he/she ? :)

Owyn 11-09-2009 08:56

Re: how do i look up ips ?
 
actually i've seen a server with announcing joinging steam + ip addresses in the HUD, only thing was different that it showed hostnames instead of just IP addresses

wonder what was that server useing to get such a result

is there a public plugin for this nowadays?


All times are GMT -4. The time now is 09:41.

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