Home 50 Report post Posted September 19, 2016 Explanation It just consists of checking if there's a cloned character around the game servers, and them automatically remove's it, without the necessity of punishing the player... HOW TO USE 1 - Make folder called players resource/script/ resource/script/players 2 - Add the fellowing functions in anywhere of your functions.lua function GetCurrentGameServer() local ret, npc = GetEudemon() return GetChaDefaultName(npc) end function SaveFile (path, name, extension, content) local file = io.open (path .. name .. extension, "w") file:write (content) file:close () end function ReadFile (path, name, extension) local file = io.open (path .. name .. extension, "r") local content = file:read () file:close () return content end function SaveGameServer (role) SaveFile(PLAYERS_DIR, GetRoleID(role), '.txt', GetCurrentGameServer()) end function AfterEnter(role) SaveGameServer(role) end function RemoveClonedCha(role) local RoleID = GetRoleID(role) local SavedGameServer = ReadFile(PLAYERS_DIR, RoleID, '.txt') local CurrentGameServer = GetCurrentGameServer() if SavedGameServer ~= CurrentGameServer then MoveCity(role, 'Prison Island') end end 3 - Add the fellowing inside of cha_timer() if Cha_Num >= 1 and Cha_Num <= 4 then RemoveClonedCha(role) end 4 - Add the fellowing inside of every map ctrl.lua, after_enter_mapname function.. ( if there's not ctrl.lua for the map of even the after_enter_* function so create it one AfterEnter(role) 5 - Add the fellowing CONSTANT to variables.lua PLAYERS_DIR = "resource/script/players/" And its done... thanks for PKODEV members tips. ATTENTION DONT USE &updateall COMMAND, cuz it'll bug the anti dupe system... 2 Quote Share this post Link to post Share on other sites
Shako 97 Report post Posted September 19, 2016 (edited) @Home how does it break when you use &updateall? and, does &misreload work then? cha_timer might take a lot of memory also. Also, you can do this and add to extensions function RemoveCloneCha ( role ) if Cha_Num >= 1 and Cha_Num <= 4 then RemoveClonedCha(role) end and then in cha_timer () just put in function cha_timer ( role , freq , time) RemoveCloneCha ( role ) end it works the same, but saves memory, i think. Edited September 19, 2016 by Shako 1 Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
Shako 97 Report post Posted September 19, 2016 Maybe instead of teleporting the cha to prison island, u can use KickCha function? I'm not sure.. Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
Home 50 Report post Posted September 19, 2016 I see, i'll try to improve it, and update... The problem with &updateall is that changes the name of the current server to "guardian" turning the anti dupe obsolete... Quote Share this post Link to post Share on other sites
Home 50 Report post Posted September 19, 2016 I didn't find a the Kickcha function, anyway when it tries teleports an cloned char it's automatically removed Quote Share this post Link to post Share on other sites
V3ct0r 2,117 Report post Posted September 19, 2016 @Home function KickCha(character) local pkt = GetPacket() WriteCmd(pkt, 1505) SendPacket(character,pkt) end 1 Quote Some useful links / Полезные ссылки Tips for making a topic in 'Questions & Help' / Рекомендации по созданию тем в разделе "Помощь" Server Advertising Section Rules / Правила раздела "Реклама серверов" Available e-mail domains for registration / Допустимые e-mail домены для регистрации User groups / Группы пользователей User ranks / Звания пользователей "Broken" pictures on the forum / "Битые" изображения на форуме Beware of scammers! / Осторожно, мошенники! My developments / Мои разработки Mods for client and server / Моды для клиента и сервера PKOdev.NET website for Tales of Pirates Server / PKOdev.NET веб-обвязка для сервера Пиратии I do not provide any help in private messages and outside the forum. Use 'Questions & Help' section please. Thank you for understanding! Я не оказываю какую-либо помощь в личных сообщениях и вне форума. Пожалуйста, используйте раздел "Пиратия: Помощь". Благодарю за понимание! Share this post Link to post Share on other sites
Totoka 152 Report post Posted September 22, 2016 (edited) Hello @V3ct0r! i would like to know if.. ~Context function KickCha Is this packet is sent to gateserver in order to disconnect it? If it does, gateserver also send a packet back to gameserver? do you know if it does a db update? In case of a cloned character, I think gateserver lost the character reference. But, do you know how is being applied this packet, into that case? Edit -- @Home, i'm trying to understand how reliable can be the packet behavior under a cloned character. Edited September 23, 2016 by Totoka 1 Quote Discord: andresc Share this post Link to post Share on other sites
Home 50 Report post Posted September 23, 2016 (edited) @Totoka kickchar gm command saves the character, so it does not do the same? Edited September 23, 2016 by Home Quote Share this post Link to post Share on other sites
Perseus 98 Report post Posted September 23, 2016 (edited) On 19/09/2016 at 11:21 AM, Shako said: @Home how does it break when you use &updateall? and, does &misreload work then? cha_timer might take a lot of memory also. Also, you can do this and add to extensions function RemoveCloneCha ( role ) if Cha_Num >= 1 and Cha_Num <= 4 then RemoveClonedCha(role) end and then in cha_timer () just put in function cha_timer ( role , freq , time) RemoveCloneCha ( role ) end it works the same, but saves memory, i think. It's the same thing >_>. If anything, it'll take up more time (minuscule though, probably won't notice) since it'll have to search for the function and then send it the params etc etc. Edited September 23, 2016 by Perseus 1 Quote Share this post Link to post Share on other sites
Home 50 Report post Posted September 23, 2016 (edited) Maybe often memory io using cha_timer is a bad idea, even with lua. So i did another solution that is triggered only onLeaveMap and onEnterMap and uses the currentMapName instead of gameServerName avoiding updateall problems... Edited September 23, 2016 by Home Quote Share this post Link to post Share on other sites
MonkeyCode 453 Report post Posted September 23, 2016 1 hour ago, Home said: Maybe often memory io using cha_timer is a bad idea, even with lua. So i did another solution that is triggered only onLeaveMap and onEnterMap and uses the currentMapName instead of gameServerName avoiding updateall problems... In the PKO 1.38 base files that I released, there is a player_timer function. Try using that one. function player_timer(role) end function map_timer(ignore, map_copy) DealAllPlayerInMap(map_copy, 'player_timer') end function initTimer() Hook:SetHookPattern("^map_copy_run_.*$", "POST", map_timer, 2) end initTimer() -- for updateall function initTicks() for i,v in pairs(MapsLists) do if(_G["map_copy_run_"..v] == nil)then _G["map_copy_run_"..v] = function(role, map_copy) end end end end do (function(file, str) local index = (function(file) local f = io.open(file, "r") local arr = {} for line in f:lines() do table.insert(arr, line) end return arr end)(file); local r = 0 for i = 1, table.getn(index) do if index[i] ~= tostring(str) then r = r + 1; end end if r == table.getn(index) then local f = io.open(file, 'a'); f:write('\n'); f:write(tostring(str)); f:close(); end end)(GetResPath('/script/help/AddHelpNPC.lua'), 'initTicks();') end 1 Quote Share this post Link to post Share on other sites
Home 50 Report post Posted September 23, 2016 thanks it'll provide a better solution Quote Share this post Link to post Share on other sites
Home 50 Report post Posted September 23, 2016 (edited) @KONGwhere can i download your files? Edited September 23, 2016 by Home Quote Share this post Link to post Share on other sites
MonkeyCode 453 Report post Posted September 23, 2016 1 hour ago, Home said: @KONGwhere can i download your files? I edited the previous post and added the player_timer() Here is the link: Quote Share this post Link to post Share on other sites
Shako 97 Report post Posted October 6, 2016 On 9/23/2016 at 9:06 PM, KONG said: In the PKO 1.38 base files that I released, there is a player_timer function. Try using that one. function player_timer(role) end function map_timer(ignore, map_copy) DealAllPlayerInMap(map_copy, 'player_timer') end function initTimer() Hook:SetHookPattern("^map_copy_run_.*$", "POST", map_timer, 2) end initTimer() -- for updateall function initTicks() for i,v in pairs(MapsLists) do if(_G["map_copy_run_"..v] == nil)then _G["map_copy_run_"..v] = function(role, map_copy) end end end end do (function(file, str) local index = (function(file) local f = io.open(file, "r") local arr = {} for line in f:lines() do table.insert(arr, line) end return arr end)(file); local r = 0 for i = 1, table.getn(index) do if index[i] ~= tostring(str) then r = r + 1; end end if r == table.getn(index) then local f = io.open(file, 'a'); f:write('\n'); f:write(tostring(str)); f:close(); end end)(GetResPath('/script/help/AddHelpNPC.lua'), 'initTicks();') end When I tried to use this, the timer doesn't run when the GS is opened, but only when I did a &updateall afterwards. Is this meant to happen? @KONG Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
MonkeyCode 453 Report post Posted October 6, 2016 14 hours ago, Shako said: When I tried to use this, the timer doesn't run when the GS is opened, but only when I did a &updateall afterwards. Is this meant to happen? @KONG thats not suppose to happen. Because maps are only loaded once only. Hooks need to apply after the initialization of maps, that is why a hook was placed in AddHelpNpc.lua, thus when GS starts the timer should run. It should work even after updateall, because initTimer() also exist outside of AddHelpNpc. The first call to initTimer() is really a dummy for set up should updateall be called. 1 Quote Share this post Link to post Share on other sites
Shako 97 Report post Posted October 6, 2016 @KONG Thanks for the clarification. It's fixed! Quote Sunny Go! Online pko.host Share this post Link to post Share on other sites
OldHero 12 Report post Posted December 16, 2016 @Home hey bro i added all but when i add function RemoveCloneCha ( role ) if Cha_Num >= 1 and Cha_Num <= 4 then RemoveClonedCha(role) end My All glows get bug. Hmm?? any idea how to fix? Quote Share this post Link to post Share on other sites
Home 50 Report post Posted December 16, 2016 @OldHero i dont use this method anymore, cuz executes a lot io Quote Share this post Link to post Share on other sites
Andrew 32 Report post Posted February 7, 2017 Isn't better use RemoveClonedCha(role) inside the function "after_enter_mapname" instead of cha_timer ? Also, using KickCha function... Quote Share this post Link to post Share on other sites
blazi10 37 Report post Posted March 18, 2017 Sooo This system is secure? i mean if it work fine and if can use "&updateall" or system will bugged? Quote Share this post Link to post Share on other sites
BugsBunny 16 Report post Posted March 28, 2017 Interesting Quote Share this post Link to post Share on other sites