Skip to content

Instantly share code, notes, and snippets.

@MEXAHOTABOP
Created July 10, 2012 20:15
Show Gist options
  • Save MEXAHOTABOP/3085934 to your computer and use it in GitHub Desktop.
Save MEXAHOTABOP/3085934 to your computer and use it in GitHub Desktop.
bool AltDown = false;
bool LeftCtrl = false;
bool key_down(uint8 key)
{
// Effect example, temporary
if(key == DIK_LCONTROL) LeftCtrl = true; // Left Control
if(key == DIK_LMENU || key == DIK_RMENU) AltDown=true;
if (AltDown && key == DIK_1)
{
uint16 pid =PID_SUPER_STIMPAK; // и тд
CritterCl@ cr = GetChosen();
ItemCl@ item = cr.GetItem( pid, -1 );
if (valid(cr) && valid(item))
{
uint[] use = { CHOSEN_USE_ITEM, item.Id, 144, 0, 0, ITEM_MODE_USE, 0 };
SetChosenActions( use );
}
}
if (AltDown && key == DIK_2)
{
uint16 pid =PID_HYPO; // и тд
CritterCl@ cr = GetChosen();
ItemCl@ item = cr.GetItem( pid, -1 );
if (valid(cr) && valid(item))
{
uint[] use = { CHOSEN_USE_ITEM, item.Id, 525, 0, 0, ITEM_MODE_USE, 0 };
SetChosenActions( use );
}
}
if (AltDown && key == DIK_3)
{
uint16 pid =PID_STIMPAK; // и тд
CritterCl@ cr = GetChosen();
ItemCl@ item = cr.GetItem( pid, -1 );
if (valid(cr) && valid(item))
{
uint[] use = { CHOSEN_USE_ITEM, item.Id, 40, 0, 0, ITEM_MODE_USE, 0 };
SetChosenActions( use );
}
}
if (AltDown && key == DIK_4)
{
uint16 pid =PID_PSYCHO; // и тд
CritterCl@ cr = GetChosen();
ItemCl@ item = cr.GetItem( pid, -1 );
if (valid(cr) && valid(item))
{
uint[] use = { CHOSEN_USE_ITEM, item.Id, 110, 0, 0, ITEM_MODE_USE, 0 };
SetChosenActions( use );
}
}
if (AltDown && key == DIK_5)
{
uint16 pid =PID_JET; // и тд
CritterCl@ cr = GetChosen();
ItemCl@ item = cr.GetItem( pid, -1 );
if (valid(cr) && valid(item))
{
uint[] use = { CHOSEN_USE_ITEM, item.Id, 259, 0, 0, ITEM_MODE_USE, 0 };
SetChosenActions( use );
}
}
if (AltDown && key == DIK_6)
{
uint16 pid =PID_JET_ANTIDOTE; // и тд
CritterCl@ cr = GetChosen();
ItemCl@ item = cr.GetItem( pid, -1 );
if (valid(cr) && valid(item))
{
uint[] use = { CHOSEN_USE_ITEM, item.Id, 260, 0, 0, ITEM_MODE_USE, 0 };
SetChosenActions( use );
}
}
if (AltDown && key == DIK_7)
{
uint16 pid =PID_MENTATS; // и тд
CritterCl@ cr = GetChosen();
ItemCl@ item = cr.GetItem( pid, -1 );
if (valid(cr) && valid(item))
{
uint[] use = { CHOSEN_USE_ITEM, item.Id, 53, 0, 0, ITEM_MODE_USE, 0 };
SetChosenActions( use );
}
}
if (AltDown && key == DIK_8)
{
uint16 pid =PID_BUFFOUT; // и тд
CritterCl@ cr = GetChosen();
ItemCl@ item = cr.GetItem( pid, -1 );
if (valid(cr) && valid(item))
{
uint[] use = { CHOSEN_USE_ITEM, item.Id, 87, 0, 0, ITEM_MODE_USE, 0 };
SetChosenActions( use );
}
}
if (key == DIK_R)
{
CritterCl@ chosen = GetChosen();
ItemCl@ weapon = _CritGetItemHand(chosen);
if(valid(chosen) && valid(weapon))
{
uint[] use = { CHOSEN_USE_ITEM, weapon.Id, 0, TARGET_SELF_ITEM, 0, ITEM_MODE_RELOAD, 0 };
SetChosenActions( use );
}
}
if(AltDown && key == DIK_Q) SetEffect(EFFECT_2D, -1, "2D_Default.fx");
if(AltDown && key == DIK_W) SetEffect(EFFECT_2D, -1, "2D_BlackWhite.fx");
if(AltDown && key == DIK_D) // Alt + D
{
RunServerScriptUnsafe ("drop@unsafe_DropInvItems", 1, 0, 0, null, null);
}
if (LeftCtrl && key == DIK_D) // Ctrl + D
{
RunServerScriptUnsafe ("drop@unsafe_DropInvItems", 0, 0, 0, null, null);
}
if (AltDown && key == DIK_G) // Alt +G
{
RunServerScriptUnsafe ("drop@unsafe_TakeAllItems", 0, 0, 0, null, null);
}
return GUI_KeyDown(key);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment