Timic Posted September 16, 2010 Share Posted September 16, 2010 g_Root = getRootElement() addEventHandler('onClientPlayerJoin', g_Root, function() outputChatBox('#449ecbJOIN: #FFFFFF' .. getPlayerName(source) .. ' #449ecbhas joined from: #FFFFFF' .. [u]getPlayerCountry(source)[/u] .. ', 255, 100, 100,true) end ) addEventHandler('onClientPlayerChangeNick', g_Root, function(oldNick, newNick) outputChatBox('#449ecbNICK: #FFFFFF' .. oldNick .. ' #449ecbis now known as #FFFFFF' .. newNick, 255, 100, 100,true) end ) addEventHandler('onClientPlayerQuit', g_Root, function(reason) outputChatBox('#449ecbQUIT: #FFFFFF' .. getPlayerName(source) .. ' #449ecbhas left the game [' .. reason .. ']', 255, 100, 100,true) end ) Can somebody Help This Link to comment
Castillo Posted September 16, 2010 Share Posted September 16, 2010 no exist such function: getPlayerCountry Link to comment
Timic Posted September 16, 2010 Author Share Posted September 16, 2010 Then how is it? Link to comment
Discord Moderators Zango Posted September 16, 2010 Discord Moderators Share Posted September 16, 2010 no exist such function: getPlayerCountry I think he's wanting advise on how to do so. Having a look at how the admin resource pulled this off, I found this: --[[********************************** * * Multi Theft Auto - Admin Panel * * admin_ip2c.lua * * Original File by lil_Toady * **************************************]] aCountries = {} function getPlayerCountry ( player ) local ip = getPlayerIP ( player ) 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 In other words, put this code in the admin resource serverside file, and it should work fine. You'd have to convert this to serverside code too. onClientPlayerJoin is onPlayerJoin, for example. Link to comment
Timic Posted September 16, 2010 Author Share Posted September 16, 2010 this not help to me ... Link to comment
Discord Moderators Zango Posted September 16, 2010 Discord Moderators Share Posted September 16, 2010 this not help to me ... There is no specific function that retrieves a players country, the nearest you get is the IP. I think you need to deepen out your question a bit instead of concluding that it wont help you. Link to comment
50p Posted September 16, 2010 Share Posted September 16, 2010 Just export that function from admin resource and call it from your resource... Link to comment
[DMC] Posted September 16, 2010 Share Posted September 16, 2010 this is a stolen client side script this is the 3rd stolen client side script timic posted ban him from here.... how do i know you say? well its from dmc... our client side is almost that but then + server =) and he edited this a tiny bit i think we should post/reply on timic stupid stuff anymore not even when he made it himself and really need help Link to comment
Recommended Posts