emanuel 18 Posted May 16, 2017 Share Posted May 16, 2017 Hello guys,any1 have functions of this ? If a player want buy somthing on the shop or quest,items drop down..i want some function to stop that and check if player have necesarry space in inventory/bag,i try on quest but now working,i need that in my source,thx. Link to comment Share on other sites More sharing options...
xDiiZeRx 42 Posted May 16, 2017 Share Posted May 16, 2017 if pc.get_empty_inventory_count() <3 then say("You dont have enough space !") Link to comment Share on other sites More sharing options...
emanuel 18 Posted May 16, 2017 Author Share Posted May 16, 2017 Acum 22 minute, xDiiZeRx a spus: if pc.get_empty_inventory_count() <3 then say("You dont have enough space !") for quest,right ? Link to comment Share on other sites More sharing options...
xDiiZeRx 42 Posted May 16, 2017 Share Posted May 16, 2017 Yes. 1 Link to comment Share on other sites More sharing options...
Premium Syreldar 1890 Posted May 16, 2017 Premium Share Posted May 16, 2017 quest give_item_with_check begin state start begin when 9001.chat."Give me the item" begin local item_vnum = 27001; say_title(string.format("%s:[ENTER]", mob_name(npc.get_race()))) if (pc.enough_inventory(item_vnum)) then pc.give_item2(item_vnum); say(string.format("You have received %s.[ENTER]", item_name(item_vnum))) else say_reward(string.format("You don't have enough space for %s.[ENTER]", item_name(item_vnum))) end -- if/else say_item_vnum(item_vnum); end -- when end -- state end -- quest 1 "Nothing's free in this life. Ignorant people have an obligation to make up for their ignorance by paying those who help them. Either you got the brains or cash, if you lack both you're useless." Syreldar Link to comment Share on other sites More sharing options...
emanuel 18 Posted May 17, 2017 Author Share Posted May 17, 2017 Acum 11 ore, Syreldar a spus: quest give_item_with_check begin state start begin when 9001.chat."Give me the item" begin local item_vnum = 27001; say_title(string.format("%s:[ENTER]", mob_name(npc.get_race()))) if (pc.enough_inventory(item_vnum)) then pc.give_item2(item_vnum); say(string.format("You have received %s.[ENTER]", item_name(item_vnum))) else say_reward(string.format("You don't have enough space for %s.[ENTER]", item_name(item_vnum))) end -- if/else say_item_vnum(item_vnum); end -- when end -- state end -- quest Yeah mate,but this function if (pc.enough_inventory(item_vnum)) i need in my source too right ? And for shop? If i buy from npc items and i have full bag,items drop down,have solution for this ? Thanx Link to comment Share on other sites More sharing options...
Premium Syreldar 1890 Posted May 17, 2017 Premium Share Posted May 17, 2017 8 hours ago, emanuel said: Yeah mate,but this function if (pc.enough_inventory(item_vnum)) i need in my source too right ? And for shop? If i buy from npc items and i have full bag,items drop down,have solution for this ? Thanx The shop automatically handles inventory space, if it doesn't you should really consider fixing it, and no, you don't need to add pc.enough_inventory(vnum) in source, it already exists. 1 "Nothing's free in this life. Ignorant people have an obligation to make up for their ignorance by paying those who help them. Either you got the brains or cash, if you lack both you're useless." Syreldar Link to comment Share on other sites More sharing options...
kimameixede 6 Posted May 17, 2017 Share Posted May 17, 2017 int pc_get_empty_inventory_size(lua_State* L) { LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr(); if (lua_isnumber(L, 1) == false){ lua_pushboolean(L, false); return 1; } int size = (int)lua_tonumber(L, 1); if (pChar != NULL) { int iEmptyCell = pChar->GetEmptyInventory(size); if (-1 == iEmptyCell) { lua_pushboolean(L, false); return 1; } lua_pushboolean(L, true); } else { lua_pushboolean(L, false); } return 1; } credits: DragonSlayer 1 Link to comment Share on other sites More sharing options...
emanuel 18 Posted May 17, 2017 Author Share Posted May 17, 2017 Acum 24 minute, kimameixede a spus: int pc_get_empty_inventory_size(lua_State* L) { LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr(); if (lua_isnumber(L, 1) == false){ lua_pushboolean(L, false); return 1; } int size = (int)lua_tonumber(L, 1); if (pChar != NULL) { int iEmptyCell = pChar->GetEmptyInventory(size); if (-1 == iEmptyCell) { lua_pushboolean(L, false); return 1; } lua_pushboolean(L, true); } else { lua_pushboolean(L, false); } return 1; } credits: DragonSlayer hello mate,where to add this function ? It's for npc shop to check inventory space when buying ? Link to comment Share on other sites More sharing options...
emanuel 18 Posted May 17, 2017 Author Share Posted May 17, 2017 1 oră în urmă, Syreldar a spus: The shop automatically handles inventory space, if it doesn't you should really consider fixing it, and no, you don't need to add pc.enough_inventory(vnum) in source, it already exists. Can you give me function for this fix bro? And if you can say me where to put it ? Function for check inventory space when buying from npc shop,thank you! 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