regal 21 Posted May 24, 2020 Share Posted May 24, 2020 (edited) Version of Files : 40k 1. Description of the problem / Question : Hello everyone. I want to make only one kingdom available for players , I changed everything from client side according to one tutorial found here(in locale/root) and now, in my client, you cannot choose anymore another empire. The problem is I want to put also something in source to check the empire and if it is different from empire id 1 for example(shinso), disconnect the player or something similar. I've come across this code from input_login.cpp, as I guess here I should work. Can someone help me to solve it out as I don't really know how I should change the values to make what I want. Right now I can change another empire if I use another client to login, so I want to forbid this, we all know that some people like to make problems, you're never safe enough... void CInputLogin::Empire(LPDESC d, const char * c_pData) { const TPacketCGEmpire* p = reinterpret_cast<const TPacketCGEmpire*>(c_pData); if (EMPIRE_MAX_NUM <= p->bEmpire) { d->SetPhase(PHASE_CLOSE); return; } const TAccountTable& r = d->GetAccountTable(); if (r.bEmpire != 0) { for (int i = 0; i < PLAYER_PER_ACCOUNT; ++i) { if (0 != r.players[i].dwID) { sys_err("EmpireSelectFailed %d", r.players[i].dwID); return; } } } TEmpireSelectPacket pd; pd.dwAccountID = r.id; pd.bEmpire = p->bEmpire; db_clientdesc->DBPacket(HEADER_GD_EMPIRE_SELECT, d->GetHandle(), &pd, sizeof(pd)); } Thank you very much for spending your time to read my problem, regal. Edited May 24, 2020 by regal 1 Link to comment Share on other sites More sharing options...
Contributor TMP4 11043 Posted May 24, 2020 Contributor Share Posted May 24, 2020 (edited) In your situation since the empires only "softlocked" then i would just use a quest like this: when login begin if pc.get_empire() > 1 then pc.change_empire(1) --command("quit") --This command will force close the client if you want to punish the cheating player end end You can add this if case to your give_basic_weapon.quest for example. Edit: I added the quit command if you want to close the player's client. Edited May 24, 2020 by TMP4 1 Link to comment Share on other sites More sharing options...
regal 21 Posted May 24, 2020 Author Share Posted May 24, 2020 (edited) 2 hours ago, TMP4 said: In your situation since the empires only "softlocked" then i would just use a quest like this: when login begin if pc.get_empire() > 1 then pc.change_empire(1) --command("quit") --This command will force close the client if you want to punish the cheating player end end when login begin if pc.get_empire() > 1 then pc.change_empire(1) --command("quit") --This command will force close the client if you want to punish the cheating player end end You can add this if case to your give_basic_weapon.quest for example. Edit: I added the quit command if you want to close the player's client. First, thank you for answering this topic. So, I made a quest like this: quest empire begin state start begin when login begin if pc.get_empire() > 1 then pc.change_empire(1) command("quit") end end end end But, when I login, nothing happens. The empire doesn't change and I'm not logged out. Do you know what I did wrong? Thank you Edited May 24, 2020 by regal Link to comment Share on other sites More sharing options...
Contributor TMP4 11043 Posted May 24, 2020 Contributor Share Posted May 24, 2020 (edited) Your "if" "then" in different line is weird but if qc can compile it then it's ok. Try to check where it stucks like this: quest empire begin state start begin when login begin say("Test1") --Every character should see this, otherwise you did not compiled your quest if pc.get_empire() > 1 then say("Just empire 2 and 3 should see this") wait() -- ok button pc.change_empire(1) command("quit") end end end end If you do not even see the "Test1" then you did not compiled your quest. Also metin2's lua implementation sometimes weird so maybe instead of this: if pc.get_empire() > 1 then try this: if pc.get_empire() == 2 or pc.get_empire() == 3 then Edited May 24, 2020 by TMP4 1 Link to comment Share on other sites More sharing options...
regal 21 Posted May 24, 2020 Author Share Posted May 24, 2020 (edited) 42 minutes ago, TMP4 said: Try to check where it stucks like this: quest empire begin state start begin when login begin say("Test1") --Every character should look this, otherwise you did not compiled your quest if pc.get_empire() > 1 then say("Just empire 2 and 3 should look this") wait() -- ok button pc.change_empire(1) command("quit") end end end end quest empire begin state start begin when login begin say("Test1") --Every character should look this, otherwise you did not compiled your quest if pc.get_empire() > 1 then say("Just empire 2 and 3 should look this") wait() -- ok button pc.change_empire(1) command("quit") end end end end If you do not even see the "Test1" then you did not compiled your quest. The Test1 appears everytime I login or change map, still it doesn't do anything. In syserr I've got this: SYSERR: May 24 20:37:57 :: RunState: LUA_ERROR: [string "empire"]:2: attempt to compare nil with number SYSERR: May 24 20:37:57 :: WriteRunningStateToSyserr: LUA_ERROR: quest empire.start click Actually I solved it out, it worked by changing pc.get_empire() > 1 then like you said. Thank you very much! Edited May 24, 2020 by regal Link to comment Share on other sites More sharing options...
Contributor TMP4 11043 Posted May 24, 2020 Contributor Share Posted May 24, 2020 (edited) No problem, as i said, metin2's lua implementation is weird so sometimes we must do the longer way Edited May 24, 2020 by TMP4 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now