for (var i = 0; gran [i] != undefined && gran [i] [0] != false; i++) {}
if (gran [i] == undefined) {gran [i] = new Array (false, 0, 0, 0, false, time.time+60, 0, 0, 0, 0, 0);}
gran [i] [4] = true; if (gran [i] [1] < 16) {gran [i] [1] += 1;} gran [i] [2] -= 5;
function grenadeThrow()
{gran [i] [1] = 0; gran [i] [5] = time.time+60; gran [i] [0] = true;
pinv = player.getInventory(); var rot = player.getRotation();
player.dropItem(Item(2052, 1)); pinv.consumeItem(2052);
itemSearch = player.getEntitiesWithinRange(0.2);
for (var ii = 0; ii < itemSearch.length; ii++) {gran [i] [3] = itemSearch[ii]; 
if (gran [i] [3].getClassType() == "Item") 
{gran [i] [3].setVelocity(Math.cos((rot.yaw+80+Math.random()*20)/57.32)/8*gran [i] [2]/2
, -rot.pitch/360*gran [i] [2]/2, Math.sin((rot.yaw+80+Math.random()*20)/57.32)/8*gran [i] [2]/2);}}
gran [i] [2] = 0;}