Jump to content

City on player join


koragg

Recommended Posts

We all know that it's easy to display from which country a player joins...but can somebody share the code which also displays from which city the player joins? I've seen it in some servers and all I know is that they get the information from a geolocation website. But I got no idea how to make that myself, so if anyone has it or wants to make it (if not too hard ofc), please help me out :)

Link to comment

a zorry then you need take his ip and see his country

countryNames = { 
    ['AD'] = 'Andorra', 
    ['AE'] = 'United Arab Emirates', 
    ['AF'] = 'Afghanistan', 
    ['AG'] = 'Antigua and Barbuda', 
    ['AI'] = 'Anguilla', 
    ['AL'] = 'Albania', 
    ['AM'] = 'Armenia', 
    ['AO'] = 'Angola', 
    ['AP'] = 'ARIPO', 
    ['AR'] = 'Argentina', 
    ['AT'] = 'Austria', 
    ['AU'] = 'Australia', 
    ['AW'] = 'Aruba', 
    ['AZ'] = 'Azerbaijan', 
    ['BA'] = 'Bosnia and Herzegovina', 
    ['BB'] = 'Barbados', 
    ['BD'] = 'Bangladesh', 
    ['BE'] = 'Belgium', 
    ['BF'] = 'Burkina Faso', 
    ['BG'] = 'Bulgaria', 
    ['BH'] = 'Bahrain', 
    ['BI'] = 'Burundi', 
    ['BJ'] = 'Benin', 
    ['BM'] = 'Bermuda', 
    ['BN'] = 'Brunei Darussalam', 
    ['BO'] = 'Bolivia', 
    ['BQ'] = 'Bonaire', 
    ['BR'] = 'Brazil', 
    ['BS'] = 'Bahamas', 
    ['BT'] = 'Bhutan', 
    ['BV'] = 'Bouvet Island', 
    ['BW'] = 'Botswana', 
    ['BY'] = 'Belarus', 
    ['BZ'] = 'Belize', 
    ['CA'] = 'Canada', 
    ['CD'] = 'Congo', 
    ['CF'] = 'Central African Republic', 
    ['CG'] = 'Congo', 
    ['CH'] = 'Switzerland', 
    ['CI'] = 'Cote d?Ivoire', 
    ['CK'] = 'Cook Islands', 
    ['CL'] = 'Chile', 
    ['CM'] = 'Cameroon', 
    ['CN'] = 'China', 
    ['CO'] = 'Colombia', 
    ['CR'] = 'Costa Rica', 
    ['CU'] = 'Cuba', 
    ['CV'] = 'Cape Verde', 
    ['CW'] = 'Curacao', 
    ['CY'] = 'Cyprus', 
    ['CZ'] = 'Czech Republic', 
    ['DE'] = 'Germany', 
    ['DJ'] = 'Djibouti', 
    ['DK'] = 'Denmark', 
    ['DM'] = 'Dominica', 
    ['DO'] = 'Dominican Republic', 
    ['DZ'] = 'Algeria', 
    ['EC'] = 'Ecuador', 
    ['EE'] = 'Estonia', 
    ['EG'] = 'Egypt', 
    ['EH'] = 'Western Sahara', 
    ['ER'] = 'Eritrea', 
    ['ES'] = 'Spain', 
    ['ET'] = 'Ethiopia', 
    ['FI'] = 'Finland', 
    ['FJ'] = 'Fiji', 
    ['FK'] = 'Malvinas', 
    ['FO'] = 'Faroe Islands', 
    ['FR'] = 'France', 
    ['GA'] = 'Gabon', 
    ['GB'] = 'United Kingdom', 
    ['GD'] = 'Grenada', 
    ['GE'] = 'Georgia', 
    ['GG'] = 'Guernsey', 
    ['GH'] = 'Ghana', 
    ['GI'] = 'Gibraltar', 
    ['GL'] = 'Greenland', 
    ['GM'] = 'Gambia', 
    ['GN'] = 'Guinea', 
    ['GQ'] = 'Equatorial Guinea', 
    ['GR'] = 'Greece', 
    ['GT'] = 'Guatemala', 
    ['GW'] = 'Guinea-Bissau', 
    ['GY'] = 'Guyana', 
    ['HN'] = 'Honduras', 
    ['HR'] = 'Croatia', 
    ['HT'] = 'Haiti', 
    ['HU'] = 'Hungary', 
    ['ID'] = 'Indonesia', 
    ['IE'] = 'Ireland', 
    ['IL'] = 'Palestine', 
    ['IM'] = 'Isle of Man', 
    ['IN'] = 'India', 
    ['IQ'] = 'Iraq', 
    ['IR'] = 'Iran', 
    ['IS'] = 'Iceland', 
    ['IT'] = 'Italy', 
    ['JE'] = 'Jersey', 
    ['JM'] = 'Jamaica', 
    ['JO'] = 'Jordan', 
    ['JP'] = 'Japan', 
    ['KE'] = 'Kenya', 
    ['KG'] = 'Kyrgyzstan', 
    ['KH'] = 'Cambodia', 
    ['KI'] = 'Kiribati', 
    ['KM'] = 'Comoros', 
    ['KN'] = 'Saint Kitts and Nevis', 
    ['KP'] = 'Korea', 
    ['KR'] = 'Korea', 
    ['KW'] = 'Kuwait', 
    ['KY'] = 'Cayman Islands', 
    ['KZ'] = 'Kazakhstan', 
    ['LA'] = 'Lao People?s Republic', 
    ['LB'] = 'Lebanon', 
    ['LC'] = 'Saint Lucia', 
    ['LI'] = 'Liechtenstein', 
    ['LK'] = 'Sri Lanka', 
    ['LR'] = 'Liberia', 
    ['LS'] = 'Lesotho', 
    ['LT'] = 'Lithuania', 
    ['LU'] = 'Luxembourg', 
    ['LV'] = 'Latvia', 
    ['LY'] = 'Libyan Arab Jamahiriya', 
    ['MA'] = 'Morocco', 
    ['MC'] = 'Monaco', 
    ['MD'] = 'Moldova', 
    ['ME'] = 'Montenegro', 
    ['MG'] = 'Madagascar', 
    ['MK'] = 'Macedonia', 
    ['ML'] = 'Mali', 
    ['MM'] = 'Myanmar', 
    ['MN'] = 'Mongolia', 
    ['MO'] = 'Macao', 
    ['MP'] = 'Northern Mariana Islands', 
    ['MR'] = 'Mauritania', 
    ['MS'] = 'Montserrat', 
    ['MT'] = 'Malta', 
    ['MU'] = 'Mauritius', 
    ['MV'] = 'Maldives', 
    ['MW'] = 'Malawi', 
    ['MX'] = 'Mexico', 
    ['MY'] = 'Malaysia', 
    ['MZ'] = 'Mozambique', 
    ['NA'] = 'Namibia', 
    ['NE'] = 'Niger', 
    ['NG'] = 'Nigeria', 
    ['NI'] = 'Nicaragua', 
    ['NL'] = 'Netherlands', 
    ['NO'] = 'Norway', 
    ['NP'] = 'Nepal', 
    ['NR'] = 'Nauru', 
    ['NZ'] = 'New Zealand', 
    ['OM'] = 'Oman', 
    ['PA'] = 'Panama', 
    ['PE'] = 'Peru', 
    ['PG'] = 'Papua New Guinea', 
    ['PH'] = 'Philippines', 
    ['PK'] = 'Pakistan', 
    ['PL'] = 'Poland', 
    ['PT'] = 'Portugal', 
    ['PW'] = 'Palau', 
    ['PY'] = 'Paraguay', 
    ['QA'] = 'Qatar', 
    ['RO'] = 'Romania', 
    ['RS'] = 'Serbia', 
    ['RU'] = 'Russian Federation', 
    ['RW'] = 'Rwanda', 
    ['SA'] = 'Saudi Arabia', 
    ['SB'] = 'Solomon Islands', 
    ['SC'] = 'Seychelles', 
    ['SD'] = 'Sudan', 
    ['SE'] = 'Sweden', 
    ['SG'] = 'Singapore', 
    ['SH'] = 'Saint Helena', 
    ['SI'] = 'Slovenia', 
    ['SK'] = 'Slovakia', 
    ['SL'] = 'Sierra Leone', 
    ['SM'] = 'San Marino', 
    ['SN'] = 'Senegal', 
    ['SO'] = 'Somalia', 
    ['SR'] = 'Suriname', 
    ['ST'] = 'Sao Tome and Principe', 
    ['SV'] = 'Salvador', 
    ['SX'] = 'Sint Maarten (Dutch part)', 
    ['SY'] = 'Syrian Arab Republic', 
    ['SZ'] = 'Swaziland', 
    ['TC'] = 'Turks and Caicos Islands', 
    ['TD'] = 'Chad', 
    ['TG'] = 'Togo', 
    ['TH'] = 'Thailand', 
    ['TJ'] = 'Tajikistan', 
    ['TL'] = 'Timor?Leste', 
    ['TM'] = 'Turkmenistan', 
    ['TN'] = 'Tunisia', 
    ['TO'] = 'Tonga', 
    ['TR'] = 'Turkey', 
    ['TT'] = 'Trinidad and Tobago', 
    ['TV'] = 'Tuvalu', 
    ['TW'] = 'Taiwan', 
    ['TZ'] = 'Tanzania', 
    ['UA'] = 'Ukraine', 
    ['UG'] = 'Uganda', 
    ['US'] = 'United States of America', 
    ['UY'] = 'Uruguay', 
    ['UZ'] = 'Uzbekistan', 
    ['VA'] = 'Holy See', 
    ['VC'] = 'Saint Vincent', 
    ['VE'] = 'Venezuela', 
    ['VG'] = 'Virgin Islands', 
    ['VN'] = 'Viet Nam', 
    ['VU'] = 'Vanuatu', 
    ['WS'] = 'Samoa', 
    ['YE'] = 'Yemen', 
    ['ZA'] = 'South Africa', 
    ['ZZ'] = 'N/A', 
    ['ZM'] = 'Zambia', 
    ['ZW'] = 'Zimbabwe', 
}; 
  
function countryDisplay() 
  local playerCountry = exports['admin']:getPlayerCountry(source)
  outputChatBox(getPlayerName(source).. "has join from "..countryName(playerCountry), root, 215, 215, 215)
end

 

Edited by Dimos7
Link to comment
1 hour ago, NeverUnbeatable said:

Use GeoIP tools: https://community.multitheftauto.com/index.php?p=resources&s=details&id=3685

But you need to edit this resource because function to get city works only for Russia.

Good luck!

Thanks. I took a look into it but it seems that all of the Russian cities are inside their own database file... So i don't think i can edit that :( Anything else you can think of? 

Link to comment
6 hours ago, pa3ck said:

You could use an API that returns JSON: http://ip-api.com/json

All you have to do is send a request with: http://ip-api.com/json/xxx.xxx.xxxx.xxxx (replace with client IP)

I found this website: http://www.geoplugin.com/

I know how to get player ip but I have really no idea how to use fetchRemote to get the city part for each newly joined player's ip location. Never had to use fetchRemote before so am in the dark now...wiki didn't help much either :/

Link to comment

Here's what I tried but for some reason it doesn't show the chatbox message, yet there are no errors in debug.

local cache = {}		--	{ [IP] = {city = table.geoplugin_city} }

-- checks cache for loc data, request via api if not available
-- sets element data asap
function checkIP(player)
	if player and isElement(player) then
		local IP = getPlayerIP(player)
	    if cache[IP] then
			-- force resync by removing
			--removeElementData(player, "city")
			setElementData(player, "city", cache[IP].city)
		elseif split(IP,'.')[1] == "192" or split(IP,'.')[1] == "172" or split(IP,'.')[1] == "10" or split(IP,'.')[1] == "127" then
			-- fetch our own IP for local adresses
			fetchRemote('http://www.geoplugin.net/json.gp', receiveIPdata, '', false, IP, getPlayerName(player))
		else
			fetchRemote('http://www.geoplugin.net/json.gp?ip=' .. IP, receiveIPdata, '', false, IP, getPlayerName(player))	
		end
	end
end

function receiveIPdata(json, err, IP, nick)
	-- check for fetchRemote errors
	if err ~= 0 then
		outputDebugString( "geoloc: receiveIPdata fetch failed, err=" .. tostring(err) .. ', json=' .. tostring(json) .. ', IP=' .. tostring(IP) .. ', nick=' .. tostring(nick))
		return
	end

	--check for parsing errors
	local table = fromJSON('['..json..']')
	if not (type(table) == 'table' and type(table.geoplugin_city) == 'string' and #table.geoplugin_city > 0) then
		outputDebugString( "geoloc: receiveIPdata parse failed, err=" .. tostring(err) .. ', json=' .. tostring(json) .. ', IP=' .. tostring(IP) .. ', nick=' .. tostring(nick))
		return
	end

	-- store data in cache
	cache[IP] = {city = table.geoplugin_city}

	-- if player is online, set element data
	local player = getPlayerFromName(nick)
	if player then
		setElementData(player, "city", table.geoplugin_city)
	end	
end

function getCity(name)
	checkIP(getPlayerFromName(name))
end
addEventHandler("onPlayerConnect", root, getCity)

function onPlayerJoin()
	local city = getElementData(source, "city")
	if city then
		outputChatBox("#FFFFFF"..getPlayerName(source).."#FFFFFF joined from #FEFE22"..city..".", root, 255, 100, 100, true)
	end
end
addEventHandler("onPlayerJoin", root, onPlayerJoin)

-- exports
function getPlayerCity(player)
	return player and isElement(player) and getIPCity(getPlayerIP(player))
end

function getIPCity(IP)
	return cache[IP] and cache[IP].city or false
end

 

Link to comment

Didn't actually test your code, but here's what I just wrote and is working fine for me. However, you will need to change it a bit so it fires @ onPlayerJoin and also change the static IP. To test it replace your ip @ line 1. 

local ip = "" -- currently it only works with pre-defined IP, because MTA detects my IP as 127.0.0.1

function getPlayerCity(p, cmd)

	function displayPlayerCity( resp, errno, p)

		if errno == 0 then
			local data = fromJSON("[".. resp .. "]")
			local status = data["status"] or "fail"
			
			if status == "success" then
				outputChatBox("Player " .. getPlayerName(p) .. " is connected from: " .. data["city"])
			else
				outputDebugString("Cannot retrieve network details")
			end
		else
			outputDebugString("Error @fetchRemote, ERRNO: " .. errno)
		end
		
	end
	
	fetchRemote("http://ip-api.com/json/" .. ip, displayPlayerCity, "", false, p)

end
addCommandHandler("gcity", getPlayerCity, false, false)

 

  • Like 1
Link to comment

@pa3ck Thanks for taking time to create that man, really appreciate it :) Here's the final code which works onPlayerJoin. I think quite a lot of users would want this at their server so that's why I'm releasing my final edited version here. It displays city and country when a player joins, and if he joins from a local PC to his local server it will show "San Andreas" as country. Thanks again for the help :D

countryNames = {
    ['AD'] = 'Andorra',
    ['AE'] = 'United Arab Emirates',
    ['AF'] = 'Afghanistan',
    ['AG'] = 'Antigua and Barbuda',
    ['AI'] = 'Anguilla',
    ['AL'] = 'Albania',
    ['AM'] = 'Armenia',
    ['AO'] = 'Angola',
    ['AP'] = 'ARIPO',
    ['AR'] = 'Argentina',
    ['AT'] = 'Austria',
    ['AU'] = 'Australia',
    ['AW'] = 'Aruba',
    ['AZ'] = 'Azerbaijan',
    ['BA'] = 'Bosnia and Herzegovina',
    ['BB'] = 'Barbados',
    ['BD'] = 'Bangladesh',
    ['BE'] = 'Belgium',
    ['BF'] = 'Burkina Faso',
    ['BG'] = 'Bulgaria',
    ['BH'] = 'Bahrain',
    ['BI'] = 'Burundi',
    ['BJ'] = 'Benin',
    ['BM'] = 'Bermuda',
    ['BN'] = 'Brunei Darussalam',
    ['BO'] = 'Bolivia',
    ['BQ'] = 'Bonaire',
    ['BR'] = 'Brazil',
    ['BS'] = 'Bahamas',
    ['BT'] = 'Bhutan',
    ['BV'] = 'Bouvet Island',
    ['BW'] = 'Botswana',
    ['BY'] = 'Belarus',
    ['BZ'] = 'Belize',
    ['CA'] = 'Canada',
    ['CD'] = 'Congo',
    ['CF'] = 'Central African Republic',
    ['CG'] = 'Congo',
    ['CH'] = 'Switzerland',
    ['CI'] = 'Cote d?Ivoire',
    ['CK'] = 'Cook Islands',
    ['CL'] = 'Chile',
    ['CM'] = 'Cameroon',
    ['CN'] = 'China',
    ['CO'] = 'Colombia',
    ['CR'] = 'Costa Rica',
    ['CU'] = 'Cuba',
    ['CV'] = 'Cape Verde',
    ['CW'] = 'Curacao',
    ['CY'] = 'Cyprus',
    ['CZ'] = 'Czech Republic',
    ['DE'] = 'Germany',
    ['DJ'] = 'Djibouti',
    ['DK'] = 'Denmark',
    ['DM'] = 'Dominica',
    ['DO'] = 'Dominican Republic',
    ['DZ'] = 'Algeria',
    ['EC'] = 'Ecuador',
    ['EE'] = 'Estonia',
    ['EG'] = 'Egypt',
    ['EH'] = 'Western Sahara',
    ['ER'] = 'Eritrea',
    ['ES'] = 'Spain',
    ['ET'] = 'Ethiopia',
    ['FI'] = 'Finland',
    ['FJ'] = 'Fiji',
    ['FK'] = 'Malvinas',
    ['FO'] = 'Faroe Islands',
    ['FR'] = 'France',
    ['GA'] = 'Gabon',
    ['GB'] = 'United Kingdom',
    ['GD'] = 'Grenada',
    ['GE'] = 'Georgia',
    ['GG'] = 'Guernsey',
    ['GH'] = 'Ghana',
    ['GI'] = 'Gibraltar',
    ['GL'] = 'Greenland',
    ['GM'] = 'Gambia',
    ['GN'] = 'Guinea',
    ['GQ'] = 'Equatorial Guinea',
    ['GR'] = 'Greece',
    ['GT'] = 'Guatemala',
    ['GW'] = 'Guinea-Bissau',
    ['GY'] = 'Guyana',
    ['HN'] = 'Honduras',
    ['HR'] = 'Croatia',
    ['HT'] = 'Haiti',
    ['HU'] = 'Hungary',
    ['ID'] = 'Indonesia',
    ['IE'] = 'Ireland',
    ['IL'] = 'Israel',
    ['IM'] = 'Isle of Man',
    ['IN'] = 'India',
    ['IQ'] = 'Iraq',
    ['IR'] = 'Iran',
    ['IS'] = 'Iceland',
    ['IT'] = 'Italy',
    ['JE'] = 'Jersey',
    ['JM'] = 'Jamaica',
    ['JO'] = 'Jordan',
    ['JP'] = 'Japan',
    ['KE'] = 'Kenya',
    ['KG'] = 'Kyrgyzstan',
    ['KH'] = 'Cambodia',
    ['KI'] = 'Kiribati',
    ['KM'] = 'Comoros',
    ['KN'] = 'Saint Kitts and Nevis',
    ['KP'] = 'Korea',
    ['KR'] = 'Korea',
    ['KW'] = 'Kuwait',
    ['KY'] = 'Cayman Islands',
    ['KZ'] = 'Kazakhstan',
    ['LA'] = 'Lao People?s Republic',
    ['LB'] = 'Lebanon',
    ['LC'] = 'Saint Lucia',
    ['LI'] = 'Liechtenstein',
    ['LK'] = 'Sri Lanka',
    ['LR'] = 'Liberia',
    ['LS'] = 'Lesotho',
    ['LT'] = 'Lithuania',
    ['LU'] = 'Luxembourg',
    ['LV'] = 'Latvia',
    ['LY'] = 'Libyan Arab Jamahiriya',
    ['MA'] = 'Morocco',
    ['MC'] = 'Monaco',
    ['MD'] = 'Moldova',
    ['ME'] = 'Montenegro',
    ['MG'] = 'Madagascar',
    ['MK'] = 'Macedonia',
    ['ML'] = 'Mali',
    ['MM'] = 'Myanmar',
    ['MN'] = 'Mongolia',
    ['MO'] = 'Macao',
    ['MP'] = 'Northern Mariana Islands',
    ['MR'] = 'Mauritania',
    ['MS'] = 'Montserrat',
    ['MT'] = 'Malta',
    ['MU'] = 'Mauritius',
    ['MV'] = 'Maldives',
    ['MW'] = 'Malawi',
    ['MX'] = 'Mexico',
    ['MY'] = 'Malaysia',
    ['MZ'] = 'Mozambique',
    ['NA'] = 'Namibia',
    ['NE'] = 'Niger',
    ['NG'] = 'Nigeria',
    ['NI'] = 'Nicaragua',
    ['NL'] = 'Netherlands',
    ['NO'] = 'Norway',
    ['NP'] = 'Nepal',
    ['NR'] = 'Nauru',
    ['NZ'] = 'New Zealand',
    ['OM'] = 'Oman',
    ['PA'] = 'Panama',
    ['PE'] = 'Peru',
    ['PG'] = 'Papua New Guinea',
    ['PH'] = 'Philippines',
    ['PK'] = 'Pakistan',
    ['PL'] = 'Poland',
    ['PT'] = 'Portugal',
    ['PW'] = 'Palau',
    ['PY'] = 'Paraguay',
    ['QA'] = 'Qatar',
    ['RO'] = 'Romania',
    ['RS'] = 'Serbia',
    ['RU'] = 'Russian Federation',
    ['RW'] = 'Rwanda',
    ['SA'] = 'Saudi Arabia',
    ['SB'] = 'Solomon Islands',
    ['SC'] = 'Seychelles',
    ['SD'] = 'Sudan',
    ['SE'] = 'Sweden',
    ['SG'] = 'Singapore',
    ['SH'] = 'Saint Helena',
    ['SI'] = 'Slovenia',
    ['SK'] = 'Slovakia',
    ['SL'] = 'Sierra Leone',
    ['SM'] = 'San Marino',
    ['SN'] = 'Senegal',
    ['SO'] = 'Somalia',
    ['SR'] = 'Suriname',
    ['ST'] = 'Sao Tome and Principe',
    ['SV'] = 'Salvador',
    ['SX'] = 'Sint Maarten (Dutch part)',
    ['SY'] = 'Syrian Arab Republic',
    ['SZ'] = 'Swaziland',
    ['TC'] = 'Turks and Caicos Islands',
    ['TD'] = 'Chad',
    ['TG'] = 'Togo',
    ['TH'] = 'Thailand',
    ['TJ'] = 'Tajikistan',
    ['TL'] = 'Timor?Leste',
    ['TM'] = 'Turkmenistan',
    ['TN'] = 'Tunisia',
    ['TO'] = 'Tonga',
    ['TR'] = 'Turkey',
    ['TT'] = 'Trinidad and Tobago',
    ['TV'] = 'Tuvalu',
    ['TW'] = 'Taiwan',
    ['TZ'] = 'Tanzania',
    ['UA'] = 'Ukraine',
    ['UG'] = 'Uganda',
    ['US'] = 'United States of America',
    ['UY'] = 'Uruguay',
    ['UZ'] = 'Uzbekistan',
    ['VA'] = 'Holy See',
    ['VC'] = 'Saint Vincent',
    ['VE'] = 'Venezuela',
    ['VG'] = 'Virgin Islands',
    ['VN'] = 'Viet Nam',
    ['VU'] = 'Vanuatu',
    ['WS'] = 'Samoa',
    ['YE'] = 'Yemen',
    ['ZA'] = 'South Africa',
    ['ZM'] = 'Zambia',
    ['ZW'] = 'Zimbabwe'
}
-------------------------------------------------------------------------------------------------------------------------
function getPlayerLocation(player)
	local ip = getPlayerIP(player)
	local countryCode = exports["admin"]:getPlayerCountry(player)
	local country = "San Andreas"
	if countryCode and countryNames[countryCode] then
		country = countryNames[countryCode]
	end
    setElementData(player, "Country", country)
	
	function displayPlayerLocation( resp, errno, player)
		if errno == 0 then
			local data = fromJSON("[".. resp .. "]")
			local status = data["status"] or "fail"
			if status == "success" then
				for k,v in ipairs(getElementsByType"player") do
					if v ~= player then
						outputChatBox("✶ Joined: #FFFFFF"..getPlayerName(player).."#FF6464 ("..data["city"]..", ".. data["country"]..") joined the server.", v, 255, 100, 100, true)
					end
				end
			else
				outputDebugString("Cannot retrieve network details")
				for k,v in ipairs(getElementsByType"player") do
					if v ~= player then
						outputChatBox("✶ Joined: #FFFFFF"..getPlayerName(player).."#FF6464 ("..country..") joined the server.", v, 255, 100, 100, true)
					end
				end
			end
		else
			outputDebugString("Error @fetchRemote, ERRNO: " .. errno)
		end
	end
	
	fetchRemote("http://ip-api.com/json/" .. ip, displayPlayerLocation, "", false, player)
end
-------------------------------------------------------------------------------------------------------------------------
function OnPlayerJoin ()
	getPlayerLocation(source)
end
addEventHandler("onPlayerJoin", getRootElement(), OnPlayerJoin)

 

Edited by koragg
server-side script btw^
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...