Results 1 to 10 of 33

Thread: [advanced] Find player's country-of-origin

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Update:
    MySQL has a built-in ip to (unsigned)int32 function, so here's the updated codscript stuff:
    PHP Code:
    getcountry(player)
    {
        
    args = [];
        
    args[0] = player;
        
    maps\mp\gametypes\_mysql::asyncQuery("SELECT country FROM countries WHERE ip < INET_ATON('" stripstring(player getip()) +  "') ORDER BY ip DESC LIMIT 1", ::showLocationargs);
    }

    showlocation(rowsargs)
    {
        if(!
    isDefined(args[0]))
                return;
        if(
    isDefined(rows) && isdefined(rows[0]) && isdefined(rows[0]["country"]))
        
    self iprintln(args[0].name " is from " rows[0]["country"]);

    with sql table:
    countries.zip

    This table does have an updated layout, so make sure you delete your old table before inserting the new one
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  2. The Following 3 Users Say Thank You to IzNoGoD For This Useful Post:

    kung foo man (2nd April 2016),Ni3ls (2nd April 2016),thOuMta (2nd April 2016)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •