Experimentat
Experimentat
Mesaje: 72
Membru din: Sâm Ian 31, 2026 4:11 pm
Server: metin2avange.mt2.xyz
Rasă: Ninja
Regat: Chunjo
  • Has thanked: 1 time
  • Cod: Selectaţi tot

    quest anti_logout_duel begin
    	state start begin
    
    		function cfg()
    			local c = {}
    			c.TAG = "[Duel]"
    			c.SEC = 60 -- blocaj 60 sec dupa ce ataci/esti atacat
    			return c
    		end
    
    		-- cand lovesti sau esti lovit
    		when kill begin
    			-- optional: nu folosim aici
    		end
    
    		-- varianta simpla: la orice hit PvP salvezi timpul (unele baze au when attack)
    		when attack begin
    			if pc.is_player() then
    				pc.setqf("pvp_last", get_time())
    			end
    		end
    
    		when logout begin
    			local c = anti_logout_duel.cfg()
    			local last = pc.getqf("pvp_last")
    			if last > 0 and (get_time() - last) < c.SEC then
    				syschat("|cff56ff00|H|h"..c.TAG.."|h|r : Nu poti iesi acum! Asteapta "..(c.SEC - (get_time() - last)).." sec.")
    				return
    			end
    		end
    
    	end
    end