Jump to content

JOIN QUIT


Recommended Posts

Posted

Do you mean, you want to show their country when they connect to the server? if so, admin panel by lil toady has something that could help, if i'm right it get's the player country (some times may fail).

Posted

You'll need to edit ip2c.lua in admin resource. I made it for you:

--[[********************************** 
* 
*   Multi Theft Auto - Trace Script 
* 
*   admin_ip2c.lua 
* 
*   Original File by lil_Toady 
* 
**************************************]] 
  
aCountries = {} 
  
function getCountry ( element ) 
    local ip  
    if type(element) == 'string' then 
        ip = element 
    else 
        ip = getPlayerIP(element) 
    end 
    if ip == "script needs acl privileges" then 
        return "script needs acl privileges" 
    end 
    if #split(ip,46) ~= 4 then 
        return false 
    end 
    local ip_group = tonumber ( gettok ( ip, 1, 46 ) ) 
    local ip_code = ( gettok ( ip, 1, 46 ) * 16777216 ) + ( gettok ( ip, 2, 46 ) * 65536 ) + ( gettok ( ip, 3, 46 ) * 256 ) + ( gettok ( ip, 4, 46 ) ) 
    if ( not aCountries[ip_group] ) then 
        loadIPGroup ( ip_group ) 
    end 
    for id, group in ipairs ( aCountries[ip_group] ) do 
        if ( ( group.rstart <= ip_code ) and ( ip_code <= group.rend ) ) then 
            return group.rcountry 
        end 
    end 
    return false 
end 
  
function loadIPGroup ( group ) 
    aCountries[group] = {} 
    local node = xmlLoadFile ( "conf/ip2c/"..group..".xml" ) 
    if ( node ) then 
        local ranges = 0 
        while ( true ) do 
            local range_node = xmlFindChild ( node, "range", ranges ) 
            if ( not range_node ) then break end 
            local rstart = tonumber ( xmlNodeGetAttribute ( range_node, "start" ) ) 
            local rend = tonumber ( xmlNodeGetAttribute ( range_node, "end" ) ) 
            local rcountry = xmlNodeGetAttribute ( range_node, "country" ) 
            local count = #aCountries[group] + 1 
            aCountries[group][count] = {} 
            aCountries[group][count].rstart = rstart 
            aCountries[group][count].rend = rend 
            aCountries[group][count].rcountry = rcountry 
            ranges = ranges + 1 
        end 
        xmlUnloadFile ( node ) 
    end 
end 
  
addEventHandler("onPlayerJoin",root, 
    function () 
        if get("outputquitjoin") == "true" then 
            outputChatBox('* ' .. getPlayerName(source) .. ' has joined the game ('..getCountry(source)..')', root, 255, 100, 100) 
        end 
    end 
) 
addEventHandler('onClientPlayerChangeNick', g_Root, 
    function(oldNick, newNick) 
        outputChatBox('* ' .. oldNick .. ' is now known as ' .. newNick, 255, 100, 100) 
    end 
) 
  
addEventHandler('onClientPlayerQuit', g_Root, 
    function(reason) 
        outputChatBox('* ' .. getPlayerName(source) .. ' has left the game [' .. reason .. ']', 255, 100, 100) 
    end 
) 

Replace it with 'ip2c.lua' in admin system

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...