Jump to content

premiere to a single player OX


Go to solution Solved by VegaS™,

Recommended Posts

premiere to a single player help me?

when 20358.chat."GM: Recompensa ao Ganhador" with pc.is_gm() and game.get_event_flag("oxevent_status") == 1 begin
	say("")
	say("Digite o ID do item: ")
	local item_vnum = input()
	say("")
	say("Qual a quantidade de itens a distribuir?")
	local item_count = input()
	say("")
	say("Digite o nome do ganhador?") -- function?
	local name = input() -- function?
	say("")
	oxevent.give_item(item_vnum, item_count, name)
	say("Eles "..oxevent.get_attender().." receberam a recompensa!")
	say("")
end

 

Link to comment
Share on other sites

  • 9 months later...
  • Forum Moderator
  • Solution

Haven't tested.

  • give_item_by_name(item_vnum, item_count, name)

______________________________________________________________________________

  • share/locale/germany/quest/quest_functions
Spoiler

oxevent.give_item_by_name

 

  • Src/game/src/questlua_oxevent.cpp
Spoiler

//1.1) Search for:
			{	"give_item",	oxevent_give_item	},
//1.2) Add after:
			{	"give_item_by_name",	oxevent_give_item_by_name	},
			
//2.1) Search for:
	ALUA(oxevent_give_item)
	{
		if (lua_isnumber(L, 1) && lua_isnumber(L, 2))
		{
			COXEventManager::instance().GiveItemToAttender((int)lua_tonumber(L, 1), (int)lua_tonumber(L, 2));
		}

		return 0;
	}
//2.2) Add after:
	ALUA(oxevent_give_item_by_name)
	{
		if (!lua_isnumber(L, 1) && !lua_isnumber(L, 2) && !lua_isstring(L, 3))
		{
			sys_err("QUEST : wrong argument");
			return 0;
		}
			
		const DWORD dwItemVnum = static_cast<DWORD>(lua_tonumber(L, 1));
		const BYTE bCount = static_cast<BYTE>(lua_tonumber(L, 2));
		const char * c_pszName = lua_tostring(L, 3);
		COXEventManager::instance().GiveItemToAttenderByName(dwItemVnum, bCount, c_pszName);
		return 0;
	}

 

  • Src/game/src/OXEvent.h
Spoiler

//1.1) Search for:
		bool CloseEvent();
//1.2) Add after:
		void GiveItemToAttenderByName(const DWORD dwItemVnum, const BYTE bCount, const char * c_pszName);

 

  • Src/game/src/OXEvent.cpp
Spoiler

//Add this function to end of file
void COXEventManager::GiveItemToAttenderByName(const DWORD dwItemVnum, const BYTE bCount, const char * c_pszName)
{
	itertype(m_map_attender) iter = m_map_attender.begin();
	for (; iter != m_map_attender.end(); ++iter)
	{
		const LPCHARACTER pkChar = CHARACTER_MANAGER::instance().FindByPID(iter->second);
		if (pkChar && !strcmp(pkChar->GetName(), c_pszName))
		{
			pkChar->AutoGiveItem(dwItemVnum, bCount);
			LogManager::instance().ItemLog(pkChar->GetPlayerID(), 0, bCount, dwItemVnum, "OXEVENT_REWARD", "", pkChar->GetDesc()->GetHostName(), dwItemVnum);
		}
	}
}

 

  • Love 1
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. 12

      Legendary items effect

    2. 0

      M2Project Research | Teamler - Beta Tester

    3. 5

      How To Directx9 Device Creation with Multiple Thread Support

    4. 25

      Increase Safebox / Warehouse

    5. 25

      Increase Safebox / Warehouse

    6. 25

      Increase Safebox / Warehouse

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