Vice City: Multiplayer

Server Development => Scripting and Server Management => Script Showroom => Topic started by: MatheuS on Jan 11, 2015, 12:24 PM

Title: [FilterScript] Country Detector
Post by: MatheuS on Jan 11, 2015, 12:24 PM
                                                          IP to Country (VCMP)

This can be useful for some people, things like countrybans(lol), language detectors, or just to admin purposes.

Download:
Click Here (MediaFire) (http://www.mediafire.com/file/3a1jh542rrphi51/IpToCountry.rar)

Installation:

Extract the files that are in the IPtoCountry folder in your server's root directory, add

function onScriptLoad()
{
   dofile( "IPtoCountry/IPtoCountry.nut" );
    secondarydb <- ConnectSQL( "IpToCountry.db" );
}

function onScriptUnload()
{
    DisconnectSQL( secondarydb );
}

function onPlayerJoin( player )
{
local country = IpToCountry( player.IP );
        Message( "[#F5FFFA]"+player.Name+" Country: [#06FA16]"+country+"[#F5FFFA]." );
}

Original scripts developed by Nexus
Link:Here (http://vcmp.liberty-unleashed.co.uk/forum/index.php?topic=714.0)

Translated by me for Vice City Multiplayer 0.4 (Some things, almost nothing)
Title: Re: [FilterScript] Country Detector
Post by: PsyChO_KiLLeR on Feb 27, 2015, 01:14 PM
getting error here
db <- ConnectSQL( "IpToCountry.db" );
Title: Re: [FilterScript] Country Detector
Post by: jayant on Feb 27, 2015, 02:47 PM
@MatheuS
function onScriptLoad()
{
   dofile( "IPtoCountry/IPtoCountry.nut" );
   secondarydb <- ConnectSQL( "IpToCountry.db" );
   Load_ITC( "IPtoCountry/" ); // Loading the detector
}
From the original topic.. ^^ ;)
Title: Re: [FilterScript] Country Detector
Post by: . on Feb 27, 2015, 02:49 PM
Quote from: Squirrel Master on Feb 27, 2015, 01:14 PMgetting error here
db <- ConnectSQL( "IpToCountry.db" );

Check that the database file "IpToCountry.db" exists and that it's accessible to the script or at least actually located where the script expects it to be.

Check the permissions on that database file if you're on a Unix system. Even if you're on windows you should still check them but Unix system are more sensitive bout that.

Finally if you still can't get it working then take a screenshot of the console output so that we can see what happens there.
Title: Re: [FilterScript] Country Detector
Post by: Thijn on Feb 27, 2015, 04:39 PM
If you're actually getting an error then that probably means you haven't loaded the SQLite plugin.
Title: Re: [FilterScript] Country Detector
Post by: MacTavish on Feb 27, 2015, 04:47 PM
The screenshot of the console error is needed to provide an proper solution  Please Click Me Mr.Squirrel Master (http://forum.vc-mp.org/?topic=113.0)
Title: Re: [FilterScript] Country Detector
Post by: PsyChO_KiLLeR on Feb 27, 2015, 06:44 PM
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi60.tinypic.com%2F1havxg.png&hash=efa1e5b5a97792168bf19df3274c3fe364aed742)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi61.tinypic.com%2Fvrzfon.png&hash=c378fcbacb009d394f2fe151aaf16975744ede05)


Now help
Title: Re: [FilterScript] Country Detector
Post by: . on Feb 27, 2015, 06:50 PM
You're missing the SQLite database plugin (https://bitbucket.org/stormeus/0.4-sqlite/downloads).
Title: Re: [FilterScript] Country Detector
Post by: MacTavish on Feb 27, 2015, 06:53 PM
Check have you loaded all plugins (execpt announce for localhost) in server.cfg
Title: Re: [FilterScript] Country Detector
Post by: PsyChO_KiLLeR on Feb 27, 2015, 07:03 PM
what i have to add in server.cfg file?
Title: Re: [FilterScript] Country Detector
Post by: . on Feb 27, 2015, 07:12 PM
Quote from: Squirrel Master on Feb 27, 2015, 07:03 PMwhat i have to add in server.cfg file?

plugins squirrel04rel32 sqlite04rel32
sqgamemode your_gamemode.nut

Please note that some of the plugin names might vary based on the platform you're on.
Title: Re: [FilterScript] Country Detector
Post by: PsyChO_KiLLeR on Feb 27, 2015, 07:17 PM
i have add them but still error here
secondarydb <- ConnectSQL( "IpToCountry.db" );
Title: Re: [FilterScript] Country Detector
Post by: PsyChO_KiLLeR on Feb 27, 2015, 07:21 PM
work fine now error was in some places there is db and in some places there is secondarydb i change all to db and then work fine
Thnx Slc and beztone
Title: Re: [FilterScript] Country Detector
Post by: Drake on Sep 09, 2015, 02:16 AM
BUMP

I saw that the IP to Country DB is really outdated so I just managed to update it with the latest IPs and thought of sharing it here.
Hope it helps. :)

Link : IpToCountry (http://www.mediafire.com/download/3a1jh542rrphi51/IpToCountry.rar)
Virus Free : VirusTotal (https://www.virustotal.com/nl/file/a21cf590f089e514189a5d83dbcee079119f90afc2ca7e02064ab7f532e0e0cd/analysis/1441776721/)

Edit by Thijn: Replaced the VirusTotal link with an analysis of the actual file instead of mediafire. It's clean.
Title: Re: [FilterScript] Country Detector
Post by: Eva on Apr 14, 2016, 04:26 PM
I get a txt msg in game "Playername Country: Unknown" while my country is in the db....
Title: Re: [FilterScript] Country Detector
Post by: KAKAN on Apr 14, 2016, 06:05 PM
Quote from: Ron on Apr 14, 2016, 04:26 PMI get a txt msg in game "Playername Country: Unknown" while my country is in the db....
But your IP is not.
Yet, mate, you did a nice bump/
And also, leave this shits, there's a plugin for that, which works great!
http://forum.vc-mp.org/?topic=1478.0
Note: It doesn't support IPs like 127.0.0.1
Title: Re: [FilterScript] Country Detector
Post by: Mohamed Boubekri on Dec 12, 2017, 12:20 PM
Niice Work @MatheuS,
I Have Created Command /country <Player> / ( Just For The Newbie Don't Know Scripting )
Here iTs Command:-
else if ( cmd == "country" )
{
if ( !text ) MessagePlayer("[#ff0000][INFO][#ffffff] /country <Player>",player);
local plr = FindPlayer(text);
if(!plr) MessagePlayer("[#FF0000]Usage Error:[#FFFFFF] Unknown Player", player);
else
{
local country = IpToCountry( plr.IP );
MessagePlayer("[#00ffff][INFO][#ffffff] Country " + plr.Name + " is "+country+".",player );
}
return 0;
}
Hope iTs Help!
Title: Re: [FilterScript] Country Detector
Post by: Retard on Dec 13, 2017, 08:01 AM
Nice Bro,Nice Work.
Title: Re: [FilterScript] Country Detector
Post by: =RK=MarineForce on May 08, 2018, 06:34 PM
I M GETTING ERROR i can't fix it . ..

MAIN LINE 49 IPTOcountry/Iptocountry.nut line 7
Title: Re: [FilterScript] Country Detector
Post by: UrbanY on May 10, 2018, 01:09 AM
Funcion:

function P_MSG( text, player ) MessagePlayer( "[#000000][[#9400D3]Pais[#000000]][#FFFFFF] " + text, player );

CMD:

else if ( cmd == "pais" )
{
if (status[ player.ID ].Registrado == false) MessagePlayer(RED+"**Usted no esta registrado!",player);
else if ( status[ player.ID ].Logado == false ) MessagePlayer(RED+"**Usted no ah iniciado sesion!",player);
else if ( !text ) MessagePlayer(ORANGE+"Usage: /" + cmd + " [Nick/ID]", player );
else {
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer(RED+" >> "+ORANGE+"Invalid Player.", player );
else {
local IP = plr.IP;
P_MSG( ""+plr.Name+" es de" + IpToCountry( plr.IP ) + ".", player );
}
}
 return 0;
}
Title: Re: [FilterScript] Country Detector
Post by: umar4911 on May 13, 2018, 05:01 AM
Quote from: =RK=MarineForce on May 08, 2018, 06:34 PMI M GETTING ERROR i can't fix it . ..

MAIN LINE 49 IPTOcountry/Iptocountry.nut line 7
post the error which is on console and what is written on the line 49. I think you use notepad. I recommend notepad++ as it makes easy to find the error on the specific line.
Title: Re: [FilterScript] Country Detector
Post by: =RK=MarineForce on May 13, 2018, 08:03 AM
Fixed by ownself Thanks For Support
Title: Re: [FilterScript] Country Detector
Post by: =RK=MarineForce on May 13, 2018, 08:03 AM
why showing unknow country? invalid ip? and need host it at vps
Title: Re: [FilterScript] Country Detector
Post by: umar4911 on May 13, 2018, 04:31 PM
Quote from: =RK=MarineForce on May 13, 2018, 08:03 AMwhy showing unknow country? invalid ip? and need host it at vps
Since, it get ip 192.168......
This is localhost ip so thats why showing invalid. If any other player joins, he will see his country.
Title: Re: [FilterScript] Country Detector
Post by: =RK=MarineForce on May 13, 2018, 04:33 PM
only for me showing ? unknow? and others tooo?

i hosted it at DMz Host At Router
Title: Re: [FilterScript] Country Detector
Post by: UrbanY on May 14, 2018, 02:53 PM
Quote from: =RK=MarineForce on May 13, 2018, 04:33 PMonly for me showing ? unknow? and others tooo?

i hosted it at DMz Host At Router

Edit the ipcountry.nut and where it says unknow change it to your liking when you enter it will come out that.
Title: Re: [FilterScript] Country Detector
Post by: =RK=MarineForce on Sep 08, 2018, 11:37 PM
@Takanaue

Why its showing Unkow bro can help me?
Title: Re: [FilterScript] Country Detector
Post by: MatheuS on Sep 09, 2018, 12:15 AM
Quote from: =RK=MarineForce on Sep 08, 2018, 11:37 PM@Takanaue

Why its showing Unkow bro can help me?

Because you're starting the server from localhost I guess
Title: Re: [FilterScript] Country Detector
Post by: Mahmoud Tornado on Sep 09, 2018, 12:32 AM
Quote from: Takanaue on Sep 09, 2018, 12:15 AMBecause you're starting the server from localhost I guess
Sure thing.
Title: Re: [FilterScript] Country Detector
Post by: =RK=MarineForce on Sep 09, 2018, 12:34 AM
There was a IPtocountry which Mohammed gave it to me it works in localhost too but i can't find bcz of i windows my pc. all old files removed.
I think Mohammed  leaved VC-MP
Title: Re: [FilterScript] Country Detector
Post by: =RK=MarineForce on Sep 10, 2018, 11:05 AM
Lmfao

i just added this

dofile( "IPtoCountry/IPtoCountry.nut" );
secondarydb <- ConnectSQL( "IPtoCountry/IpToCountry.db" );

it works Xddd

this changed by me .

Title: Re: [FilterScript] Country Detector
Post by: Mahmoud Tornado on Sep 10, 2018, 12:45 PM
Quote from: =RK=MarineForce on Sep 10, 2018, 11:05 AMLmfao

i just added this
dofile( "IPtoCountry/IPtoCountry.nut" );
secondarydb <- ConnectSQL( "IPtoCountry/IpToCountry.db" );

it works Xddd
this changed by me .


Quote from: Takanaue on Jan 11, 2015, 12:24 PMIP to Country (VCMP)
function onScriptLoad()
{
   dofile( "IPtoCountry/IPtoCountry.nut" );
    secondarydb <- ConnectSQL( "IpToCountry.db" );
}
Yes, it's really "Lmfao". >.<
Title: Re: [FilterScript] Country Detector
Post by: =RK=MarineForce on Sep 14, 2018, 10:33 AM
mahmoud i already added this but its shows me unknow so i got help by other script hmhmm :P
Title: Re: [FilterScript] Country Detector
Post by: gamingpro on Jun 14, 2023, 12:37 AM
you must be write: secondarydb <- ConnectSQL("IpToCountry.db");