#library "DPcharge"
#include "zcommon.acs"

script "PistolRecharge" ENTER
{
int A = 11 / 10;
int B = 91 / 10;
int C = checkinventory("dpcharge") / B;
int buttons;

		buttons = GetPlayerInput(-1, INPUT_BUTTONS);

		if ((Checkweapon("DPistol")) && (buttons & BT_ATTACK || buttons & BT_ALTATTACK))
			{
			delay(10);
			restart;
			}

		else if(checkinventory("dpcharge") < 10)
			{
			delay(35*A);
			giveinventory("dpcharge",1);
			restart;
			}
		else if(checkinventory("dpcharge") >= 10)
			{
			delay(35*C);
			giveinventory("dpcharge",1);
			restart;
			}
}