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

Connect location


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tedaimlocks
Member
Join Date: Jan 2024
Old 03-11-2024 , 14:12   Connect location
Reply With Quote #1

Hi, i made this code that shows players that connect but i dont know how to make it show their country. I've tried geoip and geoipse but none of them work. Ive searched for the module and the GeoIP.dat file but couldnt find it, and even searched in this forum but the links were not working anymore. So if anyone could help, or give me a working geoip module and dat file.


This is the code

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <colorchat>

#define PLUGIN "connect_disconnect"
#define VERSION "1.0"
#define AUTHOR "tedaimlocks"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_putinserver(id)
{
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))
    
ColorChat(0GREEN"^x04[SPK ZM] [^x03%s^x04]^x01 has connected."szName)
}  

public 
client_disconnected(id)
{
    new 
szName[32]
    new 
szIp[32]
    
get_user_name(idszNamecharsmax(szName))
    
get_user_ip(idszIpcharsmax(szIp))
    
ColorChat(0GREEN"^x04[SPK ZM] [^x03%s^x04]^x01 has disconnected ( ip test %s) ."szNameszIp)

tedaimlocks is offline
tedaimlocks
Member
Join Date: Jan 2024
Old 03-11-2024 , 14:20   Re: Connect location
Reply With Quote #2

Nevermind, when i made the code with country i forgot to include amxmisc, its working now
tedaimlocks is offline
tedaimlocks
Member
Join Date: Jan 2024
Old 03-11-2024 , 14:50   Re: Connect location
Reply With Quote #3

reopening this, how may i set the country to "Unknown" if it gets a error while getting locations? For example the bots

I tried this but not working
PHP Code:
#include <amxmodx>
#include <geoip>
#include <amxmisc>
#include <colorchat>

#define PLUGIN "connect_disconnect"
#define VERSION "1.0"
#define AUTHOR "tedaimlocks"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_putinserver(id)
{
    new 
szName[32]
    new 
szIp[32]
    new 
szCountry[32]
    
get_user_name(idszNamecharsmax(szName))
    
get_user_ip(idszIpcharsmax(szIp))
    
geoip_country(szIp,szCountry)
    
ColorChat(0GREEN"^x04[SPK ZM] ^x03%s^x01 has connected from ^x03%s."szNameszCountry)
}  

public 
client_disconnected(id)
{
    new 
szName[32]
    new 
szIp[32]
    new 
szCountry[32]
    
get_user_name(idszNamecharsmax(szName))
    
get_user_ip(idszIpcharsmax(szIp))
    
geoip_country(szIp,szCountry)
    
ColorChat(0GREEN"^x04[SPK ZM] ^x03%s^x01 has disconnected ( country %s) ."szNameszCountry)
    if( 
equal(szCountry"country error") ) {
        if( !
contain(szIp"192.168.") || !contain(szIp"10. ") || !contain(szIp"172.") || equal(szIp"127.0.0.1") )
            
szCountry "LAN";
        else
            
szCountry "Unknown Country";
    }

tedaimlocks is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 03-11-2024 , 15:16   Re: Connect location
Reply With Quote #4

https://forums.alliedmods.net/showthread.php?t=95665
Uzviseni Bog is offline
tedaimlocks
Member
Join Date: Jan 2024
Old 03-11-2024 , 15:53   Re: Connect location
Reply With Quote #5

Quote:
Originally Posted by Uzviseni Bog View Post
Links are invalid, but i solved them already thanks though
tedaimlocks is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 03-11-2024 , 16:03   Re: Connect location
Reply With Quote #6

Github link working
Uzviseni Bog is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 03-11-2024 , 16:33   Re: Connect location
Reply With Quote #7

https://forums.alliedmods.net/showth...08#post2679408
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 03-12-2024 , 07:16   Re: Connect location
Reply With Quote #8

Quote:
Originally Posted by tedaimlocks View Post
Hi, i made this code that shows players that connect but i dont know how to make it show their country. I've tried geoip and geoipse but none of them work. Ive searched for the module and the GeoIP.dat file but couldnt find it, and even searched in this forum but the links were not working anymore. So if anyone could help, or give me a working geoip module and dat file.
None of this information is hidden.

The database shipped with Amxx is decades out of date. Maxmind is where to get an update. I do realize S. Sudan and Kosovo are the only differences with the country part, but the IP's are perpetually changing as to what ISP goes to what country. China bought all the class A addresses (CIDR blocks) in this gap of time. There is a registration process; these days. Now I got an e-mail from Maxmind yesterday, "We're transitioning to R2 presigned URLs" and they are continuing to make it more secure to obtain a copy and go through more hoops. apt install geoipupdate is much more direct.

Quote:
As of Wednesday, May 1, 2024, we will use R2 presigned URLs for all database downloads in order to increase the security and reliability of our services
As far as scripts, Country on Name, was a go to forever to use and learn from. I made one that is much less offensive to some whereby it only states the Counties on name after kills, connect and disco. Admins see more.

If using 182 and rediscover the longitude and latitude are hosed you are not alone.

Got bored one day and started to make a WHOIS. Leaky Geoip modulate is not needed at all. It does a screen dump with what the Amx Geo module does and all kinds of seemingly useless information like their currency symbol, currency rates, etc also.
__________________
DJEarthQuake is offline
tedaimlocks
Member
Join Date: Jan 2024
Old 03-12-2024 , 09:45   Re: Connect location
Reply With Quote #9

Quote:
Originally Posted by tedaimlocks View Post
Nevermind, when i made the code with country i forgot to include amxmisc, its working now
as i said here, it has been fixed
tedaimlocks is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 03-12-2024 , 14:14   Re: Connect location
Reply With Quote #10

Quote:
Originally Posted by tedaimlocks View Post
reopening this, how may i set the country to "Unknown" if it gets a error while getting locations? For example the bots
That's not how it reads here. Glad you are satisfied.
__________________
DJEarthQuake 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 17:59.


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