Hello guys.
What I have:
my script that output in chat: Player joined from "coutry"
if SERVER then
AddCSLuaFile()
util.AddNetworkString("chat_AddText")
chat = {}
function chat.AddText(...)
net.Start("chat_AddText")
net.WriteTable({...})
net.Broadcast()
end
function get_geoip(ply)
ip = ply:IPAddress():match( "%d+%.%d+%.%d+%.%d+" ) or ""
query_string = "http://www.telize.com/geoip/" .. ip
http.Fetch( query_string,
function( body, len, headers, code )
TheReturnedHTML = body
TheReturnedCode = code
if TheReturnedCode == 200 then
country = string.match(TheReturnedHTML,"\"country\":\"%a+%\"") or string.match(TheReturnedHTML,"\"country\":\"%a+% %a+%\"")
if country != nil then
country = string.match(country,":\"%a+%\"") or string.match(country,":\"%a+% %a+%\"")
country = string.gsub(country,":","")
else
country = "\"unknown\""
end
chat.AddText(Color(255,0,0), "[Server] ", Color(255,255,255), ply:Nick().." connected from: ", Color(0,255,0),""..country)
end
end,
function( error )
TheReturnedHTML = "We failed. =("
TheReturnedCode = "1"
end
)
end
hook.Add( "PlayerInitialSpawn", "Spawn_Notification", function( ply )
get_geoip(ply)
end )
hook.Add( "PlayerDisconnected", "playerDisconnected", function(ply)
chat.AddText(Color(255,0,0), "[Server] ", Color(255,255,255), ply:Nick().." disconnected from")
end)
else
net.Receive("chat_AddText", function(len)
chat.AddText(unpack(net.ReadTable()))
end)
end
and prophunters gamemode end round board
https://github.com/mechanicalmind/prophunters/blob/master/gamemode/cl_endroundboard.luaProblem: When end round board displaying and new player finished loading on server, it(endroundboard) disappears
Its very big problem,especially when map voting in progress.
When player disconnected endroundboard do not disappears.
So where problem? In hook, or in function get_geoip() or in http.Fetch and what can I do to solve it?