Jump to content

Empire lock from source


Recommended Posts

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 by regal
  • Metin2 Dev 1
Link to comment
Share on other sites

  • Contributor

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 by TMP4
  • Love 1
Link to comment
Share on other sites

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 by regal
Link to comment
Share on other sites

  • Contributor

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 by TMP4
  • Love 1
Link to comment
Share on other sites

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 by regal
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 5

      Effect weapons

    2. 3

      Crystal Metinstone

    3. 3

      Feeding game source to LLM

    4. 113

      Ulthar SF V2 (TMP4 Base)

    5. 3

      Feeding game source to LLM

    6. 0

      Target Information System

    7. 3

      Feeding game source to LLM

    8. 2

      anti exp explanation pls

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.