Jump to content

Recommended Posts

Posted

Una pequeña función que hice rápida. Sirve para comprobar si tienes espacio para un item de x tamaño.

La paso por si a alguien le sirve, es una tontería.

 

Uso:

 

7568d5919e64874698f5b5bddffc2d65.png

 

 

questlua_pc.cpp

 

Añadimos:

 

Debajo de la función "int pc_get_empty_inventory_count( lua_State* L )"  mismo.

	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;
	}

df035b5335ea37e80dcef2fddc237954.png

 

Y en el registro de funciones:

 

a1512099867b9fbc9eceb58966bd3945.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

This site uses cookies to enhance your browsing experience and provide relevant content. By continuing to browse, you agree to our 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. and Terms of Use. For more information on how we protect your data, please check our Privacy Policy.