public void AmmoOnInventory(coItemData thisobj, coPlayer player, int amount) { coGameConnection client = player["client"]; for (int i = 0; i < 8; i++) { coItemData image = player.getMountedImage(i); if (image <= 0) continue; if (!image["ammo"].isObject()) continue; if (console.Call(image["ammo"], "getID") != console.Call(thisobj, "getID")) continue; player.setImageAmmo(i, amount != 0); int currentammo = ShapeBaseShapeBaseGetInventory(player, thisobj); if (player.getClassName() != "Player") continue; int amountInClips; if (thisobj["clip"].isObject()) { amountInClips = ShapeBaseShapeBaseGetInventory(player, thisobj["clip"]); amountInClips *= thisobj["maxInventory"].AsInt(); amountInClips += player["remaining" + thisobj.getName()].AsInt(); } else { amountInClips = currentammo; currentammo = 1; } if (player["client"] != "" && !player["isAiControlled"].AsBool()) { GameConnectionSetAmmoAmountHud(client, currentammo, amountInClips); } } }
public void WeaponImageOnMount(coScriptObject thisobj, coPlayer player, int slot) { coGameConnection client = player["client"]; string ammoName = ""; ammoName = ((coItemData)thisobj["ammo"]).getName(); int currentammo = 0; int ammountinClips = 0; if (thisobj.isField("clip")) { if (ShapeBaseShapeBaseGetInventory(player, thisobj["ammo"]).AsBool()) { player.setImageAmmo(slot, true); currentammo = ShapeBaseShapeBaseGetInventory(player, thisobj["ammo"]); } else if (ShapeBaseShapeBaseGetInventory(player, thisobj["clip"]) > 0) { ShapeBaseShapeBaseSetInventory(player, thisobj["ammo"], thisobj["ammo.maxInventory"].AsInt()); player.setImageAmmo(slot, true); currentammo = thisobj["ammo.maxInventory"].AsInt(); ammountinClips += player["remaining" + ammoName].AsInt(); } else { ammountinClips += player["remaining" + ammoName].AsInt(); } ammountinClips = ShapeBaseShapeBaseGetInventory(player, thisobj["clip"]); ammountinClips *= thisobj["ammo.maxInventory"].AsInt(); if ((player["client"] != "") && !player["isAiControlled"].AsBool()) { GameConnectionRefreshWeaponHud(client, currentammo, thisobj["item.previewImage"], thisobj["item.reticle"], thisobj["item.zoomReticle"], ammountinClips); } } else if (thisobj["ammo"] != "") { if (ShapeBaseShapeBaseGetInventory(player, thisobj["ammo"]).AsBool()) { player.setImageAmmo(slot, true); currentammo = ShapeBaseShapeBaseGetInventory(player, thisobj["ammo"]); } else currentammo = 0; if (player["client"] != "" && !player["isAiControlled"].AsBool()) GameConnectionRefreshWeaponHud(client, 1, thisobj["item.previewImage"], thisobj["item.reticle"], thisobj["item.zoomReticle"], currentammo); } }
public void WeaponImageClearAmmoClip(coItemData thisobj, coPlayer obj, int slot) { //echo("WeaponImage::clearAmmoClip: " SPC %this SPC %obj SPC %slot); // if we're not empty put the remaining bullets from the current clip // in to the player's "pocket". if (!thisobj["clip"].isObject()) return; // Commenting out this line will use a "hard clip" system, where // A player will lose any ammo currently in the gun when reloading. int pocketAmount = WeaponImageStashSpareAmmo(thisobj, obj); if (ShapeBaseShapeBaseGetInventory(obj, thisobj["clip"]) > 0 || pocketAmount != 0) obj.setImageAmmo(slot, false); }
public void ProxMineImageOnMount(coProximityMineData thisobj, coPlayer player, int slot) { player.setImageAmmo(slot, true); int numofmines = ShapeBaseShapeBaseGetInventory(player, (thisobj["item"])); string previewImage = thisobj["item.previewImage"]; string reticle = thisobj["item.reticle"]; string zoomReticle = thisobj["item.zoomReticle"]; GameConnectionRefreshWeaponHud(player["client"], 1, previewImage, reticle, zoomReticle, numofmines); }