Jump to content
Sign in to follow this  
Home

Anti Dupe - GameServer Based

Recommended Posts

 

 

HOW IT WORKS

 

STEPS

  1 - Everytime a player enters a map, it saves they CURRENT GAMESERVER in a file resource/script/players/playername.txt

  2 - When player leaves the map it saves the text "out" in the resource/script/players/playername.txt

  3 - When the player teleports to another map the destiny will check if the playername.txt contains "out" or its gameserver name"...

   ... if not ... shows a message ... "GOD IS WATCHING YOU"

 

gameserver.cfg

equment = System00

gameserver1.cfg

equment = System01

gameserver2.cfg

equment = System02

gameserver3.cfg

equment = System03

gameserver4.cfg

equment = System04

 

Functions.lua code --> place it anywhere

function GetCurrentGameServer()
  local ret, npc = GetEudemon()
  local GSName = GetChaDefaultName(npc)

  return GSName
end

function GetSavedGameServer (role)
  f = io.open ("resource/script/players/" .. GetChaDefaultName (role) .. ".txt", "r")
  SavedGameServer = f:read ()
  f:close ()

  return SavedGameServer
end

function SaveGameServer (role)
  local gameserver = GetCurrentGameServer()

  f = io.open ("resource/script/players/" .. GetChaDefaultName (role) .. ".txt", "w")
  f:write (gameserver)
  f:close ()
end

function CleanGameServer (role)
  f = io.open ("resource/script/players/" .. GetChaDefaultName (role) .. ".txt", "w")
  f:write ("out")
  f:close()
end

 

all maps ctrl.lua code

 

after enter  ( Here is where you can do whatever you want if caught the trying to dupe... ) I just show a message ('God is watching you')

	savedGS = GetSavedGameServer(role)
  currentGS = GetCurrentGameServer()

	if (savedGS ~= "out" and savedGS ~= currentGS) then
    Notice("God is watching you...")
  end

  SaveGameServer(role)

 

before leaves

  CleanGameServer(role)

 

 

Edited by Home
  • Like 9

Share this post


Link to post
Share on other sites

Using character names as an identifier is never a good idea, since you can make a boat with that name and GetChaDefaultName(role) would return the boats name. That means you could make the system think someone else was duping, and have them be punished. You should use GetRoleID(role) instead. 

  • Like 2

Share this post


Link to post
Share on other sites

i'll also create an MoveCity interceptor, that will store the player destination map, and automatically teleport him when enters the source map again, after a dupe trying

Share this post


Link to post
Share on other sites

Nevermind, figured it out,

So I duped myself, and turns out the duped item isn't kept due to a function :D

Catches the person in system so all can see

I did do a finding that the item being duped, will disappear if the person puts it back in the inventory and tele's to a new place.

test.PNG

 

 

  • Like 1

Share this post


Link to post
Share on other sites
int lua_FindChaClone(lua_State *pLS) {
  const char* useract = lua_tostring(pLS, 1);
  unsigned long userid = (unsigned long)lua_tonumber(pLS, 2);
  const char* usermap = lua_tostring(pLS, 3);
  BEGINGETGATE();
  CPlayer *pCPlayer;
  CCharacter *pCha = 0;
  GateServer *pGateServer;
  while (pGateServer = GETNEXTGATE()) {
    if (!BEGINGETPLAYER(pGateServer)) continue;
    int nCount = 0;
    while (pCPlayer = (CPlayer*) GETNEXTPLAYER(pGateServer)) {
      if (nCount > GETPLAYERCOUNT(pGateServer)) break;
      pCha = pCPlayer->GetMainCha();
      if (!pCha) continue;
      const char* cmpact = pCPlayer->GetActName();
      if (std::strcmp(useract, cmpact) == 0) {
        if (userid != pCha->m_ID)
          g_pGameApp->ReleaseGamePlayer(pCPlayer);
        if (std::strcmp(usermap, pCha->GetSubMap()->GetName()) == 1)
          g_pGameApp->ReleaseGamePlayer(pCPlayer);
      }
    }
  } return 1;
}

Perhaps this could help someone. It was an earlier version of antidupe I did. works fine, you just need to know when and how to call it.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×