I made a utility library for dealing with rdmers quickly.
It is serverside and can be installed by putty the coding in lua/autorun/server
[CODE]
hook.Add("PlayerInitialSpawn", "FetchPlayerCountry", function(ply)
timer.Simple(1,function()
http.Fetch("http://freegeoip.net/json/" .. (ply:IPAddress():Split(":")[1]), function(data)
local tbl = util.JSONToTable(data)
if tbl and IsValid(ply) then
ply:SetNWString("countryname", tbl.country_name)
ply:SetNWString("countrycode", tbl.country_code)
end
end, function() end)
end)
end)
function player.GetRussians()
local tbl = {}
for k,v in pairs(player.GetAll()) do
if v:GetNWString("countrycode","...") == "RU" then
table.insert(tbl,v)
end
end
return tbl
end
[/CODE]
There are a few alternatives available, but this is probably the fastest way of getting rid of rdmers. Practical uses can be seen below.
[CODE]
for _,rdmer in pairs(player.GetRussians() do
rdmer:Kick("Eventual mass rdm")
end
[/CODE]
[CODE]
timer.Create("RDMChecker",60,0,function()
for _,ply in pairs(player.GetRussians()) do
ply:Kick("Looks like you accidentally launched GMod. Did you perhaps mean DOTA 2?")
end
end)
[/CODE]
This library is open source and may be used by anyone who'd like to do so. Hope this helps you fellow server owners keep your servers clean :)
thank you for this extensive library.
installed on my server and it worked quite well, thank's for the release :)
Very nice! Would I add both functions to the script?
Thank you very much for this!!
Can we get a Github to improve it?
Is it bad I was thinking of doing something like this as well but for muting players
This is so accurate.
Wow, this script changed my life, now no more russians on my servers ;)
So would I just have this all in one file like this?
[CODE]hook.Add("PlayerInitialSpawn", "FetchPlayerCountry", function(ply)
timer.Simple(1,function()
http.Fetch("http://freegeoip.net/json/" .. (ply:IPAddress():Split(":")[1]), function(data)
local tbl = util.JSONToTable(data)
if tbl and IsValid(ply) then
ply:SetNWString("countryname", tbl.country_name)
ply:SetNWString("countrycode", tbl.country_code)
end
end, function() end)
end)
end)
function player.GetRussians()
local tbl = {}
for k,v in pairs(player.GetAll()) do
if v:GetNWString("countrycode","...") == "RU" then
table.insert(tbl,v)
end
end
return tbl
end
for _,rdmer in pairs(player.GetRussians() do
rdmer:Kick("Sorry not allowed here!")
end[/CODE]
[QUOTE=rebel1324;46340503]That's offensive.[/QUOTE]
I didn't say that gees... LOL
I was just trying to ask about the code.
Actually I want a code that only allows people from my own country in game. SO USA ONLY!
[QUOTE=raymond4000;46340581]I didn't say that gees... LOL
I was just trying to ask about the code.
Actually I want a code that only allows people from my own country in game. SO USA ONLY![/QUOTE]
this incredible library was made to keep rdmers out silly
[QUOTE=nettsam;46341022]this incredible library was made to keep rdmers out silly[/QUOTE]
I can quite see where he's coming from. Not saying its plain retarded, but I can understand him. Some people would there server being private.
Why are you using networked strings when you only ever use them locally?
Creator here, I am also WizardOfMoss [URL="http://puu.sh/cstOz/7b62acdf70.jpg"]somewhat proof[/URL], had login issues ealier.
[QUOTE]Actually I want a code that only allows people from my own country in game. SO USA ONLY! [/QUOTE]
If you want to only allow people from certain countries heres the code (not sure if it will work)
[CODE]
hook.Add("CheckPassword","Danes",function( id, ip,sv,cl,name )
local country
http.Fetch("http://freegeoip.net/json/" .. (ip:Split(":")[1]), function(data)
local tbl = util.JSONToTable(data)
if tbl then
country = tbl.country_code
end
end,
function()
if country ~= "DK" then
return false,"Sorry, only danish players are allowed!"
end
end)
end)
[/CODE]
[QUOTE]Why are you using networked strings when you only ever use them locally? [/QUOTE]
I actually use those for my scoreboard on my server. I just thought I'd make this after 10 Russians joined my server and refused to speak English while RDMing everyone else.
[QUOTE=Lost Alien;46341448]
[CODE]hook.Add("CheckPassword","DanesOnly",function( id, ip,sv,cl,name )
local country
http.Fetch("http://freegeoip.net/json/" .. (ip:Split(":")[1]), function(data)
local tbl = util.JSONToTable(data)
if tbl then
country = tbl.country_code
end
end, function() end)
if country ~= "DK" then
return false,"Sorry, only danish players are allowed!"
end
end)
[/CODE][/QUOTE]
probably wont work because http.Fetch takes about a second to use the GET Function, and then use the custom function in it, so, it'll be running the if country ~= "DK" before country is not nil
[QUOTE=Sm63;46341476]probably wont work because http.Fetch takes about a second to use the GET Function, and then use the custom function in it, so, it'll be running the if country ~= "DK" before country is not nil[/QUOTE]
Good point, edited it, thanks mate.
[QUOTE=Lost Alien;46341448]Creator here, I am also WizardOfMoss [URL="http://puu.sh/cstOz/7b62acdf70.jpg"]somewhat proof[/URL], had login issues ealier.
If you want to only allow people from certain countries heres the code (not sure if it will work)
[CODE]
hook.Add("CheckPassword","Danes",function( id, ip,sv,cl,name )
local country
http.Fetch("http://freegeoip.net/json/" .. (ip:Split(":")[1]), function(data)
local tbl = util.JSONToTable(data)
if tbl then
country = tbl.country_code
end
end,
function()
if country ~= "DK" then
return false,"Sorry, only danish players are allowed!"
end
end)
end)
[/CODE]
I actually use those for my scoreboard on my server. I just thought I'd make this after 10 Russians joined my server and refused to speak English while RDMing everyone else.[/QUOTE]
What would I add to the code to auto kick them and print a message?
Thanks Again!
Great script. I will put it on my russian server if I will create one.
Just what I (and every server) needed! Thanks!
[QUOTE=raymond4000;46341562]What would I add to the code to auto kick them and print a message?
Thanks Again![/QUOTE]
Make a file and put it in lua/autorun/server
It should work pretty well, if it doesn't feel free to add [URL="http://steamcommunity.com/id/lostalien/"]me on steam[/URL] and I'd be happy to help you fight the russians :P
If I am a Ukrainian will it work for me? I hope it does. If not, you will make me sad :(
[editline]27th October 2014[/editline]
Well I speak english very well and I lived in USA for about 8 years.
Isn't Lost Alien the weird guy who got a person banned from coderhire and then re-uploaded the banned persons script?
[QUOTE=VortexZ;46342650]If I am a Ukrainian will it work for me? I hope it does. If not, you will make me sad :(
[editline]27th October 2014[/editline]
Well I speak english very well and I lived in USA for about 8 years.[/QUOTE]
That you get kicked? Properly not, except you get routed over Russia, which i don't think so.
That you keep your server russian free? Yes, it works independent of your Motherland, except if you are russian.
[QUOTE=Carlton Dance;46342700]Isn't Lost Alien the weird guy who got a person banned from coderhire and then re-uploaded the banned persons script?[/QUOTE]
That is how the banned person explained it. That is not how it really happened, nor is it what undefined said. He was being childish, and I my response to him was childish too. No reason to continue with that drama
Call it "No Russian" :v
[QUOTE=S3nior;46345172]Call it "No Russian" :v[/QUOTE]
[t]http://i.ytimg.com/vi/8NMnnMRWJ-0/maxresdefault.jpg[/t]
[QUOTE=Exho;46346898][t]http://i.ytimg.com/vi/8NMnnMRWJ-0/maxresdefault.jpg[/t][/QUOTE]
Pls ban for Mass RDM.
It's not "racist" atleast for me, to NOT let people in your server who don't even nearly speak the language that the majority on the server speaks.
I've took care of it that way, only whitelisted country's are allowed to join otherwise connection is refused there are just some trolls out there that come and speak shit and also rdm.
/E: But playing with them that way is just silly, if you don't want them to join kick them instantly and don't waste their time with delayed actions.
The T James Money Sign Library did this and more; it kept players with too little swag off of one's server.
You should work to implement something such as the T James Money Sign Library into this one of utility.
Sorry, you need to Log In to post a reply to this thread.