Jump to content

Blocking IP Address to Killings


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

I made these tutorial at the request of a member from this community who wanted to buy this very simple verification.

Spoiler

2254507b46693f53f201bd91bbb1b7fb1b8636.g

 

Example quest:

quest shit_function begin
	state start begin
		when kill with npc.is_pc() begin
			local global_insult_sex
				if pc.get_sex() == 0 then
					global_insult_sex = "gay"
				else
					global_insult_sex = "bitch"
				end
				
			local check_my_ip = pc.get_ip()
			local check_enemy_ip = npc.get_ip()
  
				if check_my_ip == check_enemy_ip then
					say("You're too "..global_insult_sex.."!")
					return	
			end
		end
	end
end

Server/quest_functions

pc.get_ip
npc.get_ip

Src/game/questlua_pc.cpp

	int pc_get_ip(lua_State* L)
	{
		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
		if(!ch) return 0;
 
		lua_pushstring(L, ch->GetDesc()->GetHostName());
		return 1;
	}
	
	{ "get_ip",				pc_get_ip							},

Src/game/questlua_npc.cpp

	int npc_get_ip(lua_State* L)
    {
        LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
        if (npc && npc->IsPC())
            lua_pushstring(L, npc->GetDesc()->GetHostName());
        else
            lua_pushstring(L, "");
        return 1;
    }
	
	{ "get_ip",						npc_get_ip						},

 

    #include "desc.h"

 

Bonus

Spoiler

 

mKCWHQU.png

Shit code (Not tested, only for see how to check function in count kill):


--[[
##########################################
# Quest: Blocking IP address to killings #
# Date: 25/05/2016    	                 #
##########################################
]]

	function Verification_Ip_Adress()
		local search_me = pc.get_ip()
		local search_enemy = npc.get_ip()	
		local table_count_kill_ip = pc.getqf("count_ip_block")	
		if search_me == search_enemy then
			pc.setqf("count_ip_block", pc.getqf("count_ip_block") + 1)
		end	
	end
	function Verification_Block()
		local go_to_text_insult_find_by_race
		if pc.get_sex() == 0 then
			go_to_text_insult_find_by_race = "gay"
		else
			go_to_text_insult_find_by_race = "bitch"
		end	
		local block_me = pc.get_ip()
		local block_enemy = npc.get_ip()	
		local list_block_ = pc.getqf("count_ip_block")	
		if block_me == block_enemy and list_block_ == 10 then
			say("You're too "..go_to_text_insult_find_by_race.."!")
			pc.setqf("count_ip_block", 0) -- restart 
 ---- your function for ban or etc etc... --------
			return
		end
	end
        when kill with npc.is_pc() begin	
			if get_time() < pc.getqf("time_kill") then
				syschat("Not yet passed the 5 minutes after the last killing!")
				return
			end

			pvp_global.Verification_Block()
			pvp_global.Verification_Ip_Adress()
			pc.setqf("time_kill", get_time()+ 300)
		end
	end

These features already exist in the source, but for some it may have been helpful.

 

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 6
  • Love 1
Link to comment
Share on other sites

On 09.06.2016 at 4:33 AM, MrLibya said:

thx for the code , but it's useless , I can talk to my friend and keep killing him

or use different laptop and use a vpn ,  

This happens in the most serious cases.
I think a normal player who no has this knowledge can not do that .
Thank you for your answer :) ^^

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.