Jump to content

Error item.remove


Recommended Posts

  • Replies 11
  • Created
  • Last Reply

Top Posters In This Topic

Acum 46 minute, hachiwari a spus:

pc.remove_item(vnum, count)

      when 20023.take with item.vnum == 50300 and game.get_event_flag("book") == 1 begin
         local num = number(1,54)
         local tomes = {50401,50402,50403,50404,50405,50406,50416,50417,50418,50419,50420,50421,50431,50432,50433,50434,50435,50436,50446,50447,50448,50449,50450,50451,50461,50462,50463,50464,50465,50466,50476,50477,50478,50479,50480,50481,50496,50495,50494,50493,50492,50491,50506,50507,50508,50509,50510,50511,50530,50531,50532,50533,50534,50535}
         pc.remove_item(50300, 1)
         pc.give_item2(tonumber(tomes[num]),1)

Function pc.remove_item() delete the first item in inventory.

Function item.remove delete all items.

I don't speak English.

Link to comment
Share on other sites

int item_remove_count(lua_State * L)
{
	LPITEM pkItem = CQuestManager::instance().GetCurrentItem();
	BYTE bCount = (BYTE)(lua_tonumber(L, 1);
	
	if (pkItem && CQuestManager::instance().GetCurrentCharacterPtr() == pkItem->GetOwner() && (pkItem->GetCount() - bCount) >= 0)
		pkItem->SetCount(pkItem->GetCount() - bCount);
	
	CQuestManager::instance().ClearCurrentItem();
	return 0;
}

{ "remove_count", item_remove_count },

item.remove_count(10)
	

 

Link to comment
Share on other sites

Acum 15 minute, Endymion a spus:

int item_remove_count(lua_State * L)
{
	LPITEM pkItem = CQuestManager::instance().GetCurrentItem();
	BYTE bCount = (BYTE)(lua_tonumber(L, 1);
	
	if (pkItem && CQuestManager::instance().GetCurrentCharacterPtr() == pkItem->GetOwner() && (pkItem->GetCount() - bCount) >= 0)
		pkItem->SetCount(pkItem->GetCount() - bCount);
	
	CQuestManager::instance().ClearCurrentItem();
	return 0;
}

{ "remove_count", item_remove_count },

item.remove_count(10)
	

Where add?

 

Link to comment
Share on other sites

Acum 45 minute, xP3NG3Rx a spus:

Don't you see the problem?

Solved. Thanks.

	//item.remove_count
	int item_remove_count(lua_State * L)
	{
		LPITEM pkItem = CQuestManager::instance().GetCurrentItem();
		//BYTE bCount = (BYTE) (lua_tonumber(L, 1);
		DWORD bCount = (DWORD) lua_tonumber(L, 1);
	
		if (pkItem && CQuestManager::instance().GetCurrentCharacterPtr() == pkItem->GetOwner() && (pkItem->GetCount() - bCount) >= 0)
			pkItem->SetCount(pkItem->GetCount() - bCount);
	
		CQuestManager::instance().ClearCurrentItem();
		return 0;
	}
	//item.remove_count

 

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



×
×
  • 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.