Hi. Summer is starting to bore me, so I'm looking for more projects to occupy my time with. If you want lua bindings to anything, source engine or otherwise, request them here!
Note that I have a job irl, so I probably won't be able to get every request done nor requests that are really big or intricate.
A decent/working geoIP module! There used to be one but AFAIK it's broken currently. An update/fix to that would be great!
Linux luasockets
[QUOTE=CallMePyro;45360667]A decent/working geoIP module! There used to be one but AFAIK it's broken currently. An update/fix to that would be great![/QUOTE]
Actually, I can't really see why you would need one
You could do something like this:
[code]
gameevent.Listen( "player_connect" )
function IPSearch( data )
local name = data.name
local steam = data.networkid
local ip = data.address
local usrid = data.userid
local bot = data.bot
local index = data.index
if ( !ip or ip == "" ) then
return
end
local exploded = string.Explode(":", ip)
if ( !exploded or exploded == "127.0.0.1" or exploded == "localhost" ) then
return
end
http.Fetch("http://freegeoip.net/csv/"..exploded[1], function(body, len, headers, code)
IPCallback( name, steam, body )
end)
end
hook.Add("player_connect", "GetIPInfo", IPSearch)
function IPCallback( name, steam, contents )
local tab = string.Explode(",", contents)
local ip = tab[1]
local country = tab[3]
if ( !country ) then return end
country = string.gsub(country, [["]], [[]])
ip = string.gsub(ip, [["]], [[]])
if ( country == "United States" ) then
country = "The USA"
end
local basetext = name .. " has joined the server from " ..country .. " (" .. steam .. ")"
print( basetext .. " [" .. ip .. "] !")
for k,v in pairs(player.GetAll()) do
v:ChatPrint( basetext .. " !")
end
end
[/code]
Why not make it send the country code of that system to the server instead, and have the server process it? It's a much simpler way than messing with GeoIP.
[code]net.Start("InitialSpawnCountry")
net.WriteString(system.GetCountry())
net.SendToServer()[/code]
These may be of use too:
[code]local countries = {
["US"]="the United States",
["LT"]="Lithuania",
["RU"]="Russia",
["AU"]="Australia",
["GB"]="the United Kingdom",
["FL"]="Finland",
["KR"]="South Korea",
["NZ"]="New Zealand",
["CA"]="Canada",
["ES"]="Spain",
["FR"]="France",
["PL"]="Poland",
["SE"]="Sweden",
["NO"]="Norway",
["AE"]="the UAE",
["TR"]="Turkey",
["QA"]="Qatar",
["PK"]="Pakistan",
["NL"]="the Netherlands",
["AN"]="the Netherlands [Antilles]",
["NZ"]="New Zealand",
["RO"]="Romania",
["IT"]="Italy",
["KG"]="Kyrgyzstan",
["IS"]="Iceland",
["GE"]="Germany",
["BR"]="Brazil",
["AT"]="Austria",
["HK"]="Hong Kong",
["JP"]="Japan",
["CN"]="the D.P.R.O. China",
["BE"]="Belgium",
["FX"]="Metropolitan France",
["HU"]="Hungary",
["KP"]="the D.P.R.O. Korea",
["LU"]="Luxembourg",
["LY"]="Libyan Arab Jamahiriya",
["MX"]="Mexico",
["RS"]="Serbia",
["SG"]="Singapore",
["SI"]="Slovakia [Republic of]",
["SB"]="Slovenia",
["TW"]="Taiwan, China",
["TT"]="Trinidad & Tobago",
["CH"]="Switzerland",
["UM"]="a United States Minor Island",
["VN"]="'Vietnam",
["IE"]="the Republic of Ireland",
["DK"]="Denmark",
["CZ"]="the Czech Republic",
["EG"]="Egypt",
["ID"]="Indonesia",
["PF"]="French Indonesia",
["JM"]="Jamaica",
["IQ"]="Iraq",
["KY"]="Cayman Islands",
}[/code]
Dunno if the locale changes it though. My PC is set to japanese, would lua think I'm in japan?
[QUOTE=zerothefallen;45361742]Dunno if the locale changes it though. My PC is set to japanese, would lua think I'm in japan?[/QUOTE]
Most likely, though it's not something I've tried really experimenting with.
[QUOTE=Mors Quaedam;45361726]Why not make it send the country code of that system to the server instead, and have the server process it? It's a much simpler way than messing with GeoIP.
[code]net.Start("InitialSpawnCountry")
net.WriteString(system.GetCountry())
net.SendToServer()[/code]
These may be of use too:
[code]local countries = {
["US"]="the United States",
["LT"]="Lithuania",
["RU"]="Russia",
["AU"]="Australia",
["GB"]="the United Kingdom",
["FL"]="Finland",
["KR"]="South Korea",
["NZ"]="New Zealand",
["CA"]="Canada",
["ES"]="Spain",
["FR"]="France",
["PL"]="Poland",
["SE"]="Sweden",
["NO"]="Norway",
["AE"]="the UAE",
["TR"]="Turkey",
["QA"]="Qatar",
["PK"]="Pakistan",
["NL"]="the Netherlands",
["AN"]="the Netherlands [Antilles]",
["NZ"]="New Zealand",
["RO"]="Romania",
["IT"]="Italy",
["KG"]="Kyrgyzstan",
["IS"]="Iceland",
["GE"]="Germany",
["BR"]="Brazil",
["AT"]="Austria",
["HK"]="Hong Kong",
["JP"]="Japan",
["CN"]="the D.P.R.O. China",
["BE"]="Belgium",
["FX"]="Metropolitan France",
["HU"]="Hungary",
["KP"]="the D.P.R.O. Korea",
["LU"]="Luxembourg",
["LY"]="Libyan Arab Jamahiriya",
["MX"]="Mexico",
["RS"]="Serbia",
["SG"]="Singapore",
["SI"]="Slovakia [Republic of]",
["SB"]="Slovenia",
["TW"]="Taiwan, China",
["TT"]="Trinidad & Tobago",
["CH"]="Switzerland",
["UM"]="a United States Minor Island",
["VN"]="'Vietnam",
["IE"]="the Republic of Ireland",
["DK"]="Denmark",
["CZ"]="the Czech Republic",
["EG"]="Egypt",
["ID"]="Indonesia",
["PF"]="French Indonesia",
["JM"]="Jamaica",
["IQ"]="Iraq",
["KY"]="Cayman Islands",
}[/code][/QUOTE]
My code was simply an example, the tab contains more than just the ip and the country
Okay, so am I or am I not working on the geoip module?
[QUOTE=Chessnut;45360763]Linux luasockets[/QUOTE]
Never done a linux module before, so as long as garry's module crap doesn't throw a fit, I'll give it a go. What specifically do you want?
[editline]12th July 2014[/editline]
[QUOTE=zerothefallen;45361742]My PC is set to japanese[/QUOTE]
Wow, nerd.
[QUOTE=CallMePyro;45360667]A decent/working geoIP module! There used to be one but AFAIK it's broken currently. An update/fix to that would be great![/QUOTE]
Seems that I've forgotten to send newest binaries, compile yourself from [URL]svn://svn.metastruct.org/gbins[/URL]
Original thread: [URL]http://www.facepunch.com/showthread.php?t=969950[/URL]
[QUOTE=Chessnut;45360763]Linux luasockets[/QUOTE]
[URL]svn://svn.metastruct.org/gbins[/URL]
Windows and linux working (plus ipv6 support)
If you would like to add your own project there or contribute a fix leave a steam/facepunch profile message.
gm_vfs for gmod 13.
[url]http://facepunch.com/showthread.php?t=1094565[/url]
Because there are so many good things to be made from creating (read:downloading) files in-game without making the entire filesystem vulnerable
[QUOTE=suchipi;45395272]gm_vfs for gmod 13.
[url]http://facepunch.com/showthread.php?t=1094565[/url]
Because there are so many good things to be made from creating (read:downloading) files in-game without making the entire filesystem vulnerable[/QUOTE]
To quote coldfusion in that thread:
[QUOTE=CawldFussuian;30253113]this module needs to be installed on the client making it pretty useless[/QUOTE]
As the owner of a server, in order to do the downloading crap you want to do, you'd need to have each client install this module.
Unless you want a module that just gives you unrestricted file i/o?
I'm fine requiring that clients install it as long as I can implement a check that it's loaded
And I actually am looking for "unrestricted" i/o but only within the garrysmod directory (or a search path within it like vfs uses), if a server owner asked me to install a completely unrestricted i/o module I'd probably say hell no
EDIT: The reason I am looking for this specifically is to implement a new pac3 part that lets players with this module loaded load mdl/vtf/etc files from URL. Players without the module would just see an error, but players with the module would download the models and precache them, so then the source engine could just handle them normally
What's the point of binary modules?
I request that we team up and write some
[QUOTE=Handsome Matt;45373535]Can you get a http listing of that svn server. I haven't installed an svn client in years and don't intend to![/QUOTE]
[url=http://storm.benjojo.co.uk/svnout/svnout-master/]Ben Jojo's svn out[/url]
[QUOTE=Newbrict;45404273]What's the point of binary modules?
I request that we team up and write some[/QUOTE]
Binding shit to gmod's lua interface for fun and profit.
For instance, I could bind sdk functions that people want but no one has made modules for, or I could bind stuff like winamp or whatever to a module.
Sorry, you need to Log In to post a reply to this thread.