Skip to content

Instantly share code, notes, and snippets.

@mackal
Created July 27, 2014 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mackal/a215c96161af4989b4c2 to your computer and use it in GitHub Desktop.
Save mackal/a215c96161af4989b4c2 to your computer and use it in GitHub Desktop.
/*
* Project: MQ2Bags
* Author: demonstar55
* Purpose: Bring the newer clients open all bags to UF (and older I guess)
*
* Binds Shift + B to open all bags, and close them, exactly like newer clients do
* Adds /bags command that does the same thing
*
*/
#include "../MQ2Plugin.h"
PreSetup("MQ2Bags");
void ToggleBags(PSPAWNINFO pChar, PCHAR szLine);
void KeyBags(PCHAR NAME, BOOL Down);
bool bOpen = false;
PLUGIN_API VOID InitializePlugin(VOID)
{
DebugSpewAlways("Initializing MQ2Bags");
//Add commands
AddCommand("/bags", ToggleBags);
KeyCombo ToggleBags;
RemoveMQ2KeyBind("TOGGLE_BAGS");
AddMQ2KeyBind("TOGGLE_BAGS", KeyBags);
ParseKeyCombo("shift+b", ToggleBags);
SetMQ2KeyBind("TOGGLE_BAGS", false, ToggleBags);
}
PLUGIN_API VOID ShutdownPlugin(VOID)
{
DebugSpewAlways("Shutting down MQ2Bags");
//Remove commands
RemoveCommand("/bags");
RemoveMQ2KeyBind("TOGGLE_BAGS");
}
void ToggleBags(PSPAWNINFO pChar, PCHAR szLine)
{
if (bOpen) {
DoMappable(pChar, "CLOSE_INV_BAGS");
bOpen = false;
} else {
DoMappable(pChar, "OPEN_INV_BAGS");
bOpen = true;
}
return;
}
void KeyBags(PCHAR NAME, BOOL Down)
{
if (Down)
ToggleBags((PSPAWNINFO)pCharSpawn, "");
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment