amosth 9 Posted February 3, 2018 Share Posted February 3, 2018 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 More sharing options...
Forum Moderator Solution VegaS™ 10281 Posted November 27, 2018 Forum Moderator Solution Share Posted November 27, 2018 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); } } } 1 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON 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