- float ownderammo = GetResourceAmount(own, ammotype);
- thisammo = min(ownderammo, GetResourceAmount(wep, ammotype));
- SetResourceAmount(wep, ammotype, thisammo);
- SetResourceAmount(own, ammotype, ownderammo - thisammo);
-
- switch (ammotype)
- {
- case RESOURCE_SHELLS: s = sprintf("%s and %d shells", s, thisammo); break;
- case RESOURCE_BULLETS: s = sprintf("%s and %d nails", s, thisammo); break;
- case RESOURCE_ROCKETS: s = sprintf("%s and %d rockets", s, thisammo); break;
- case RESOURCE_CELLS: s = sprintf("%s and %d cells", s, thisammo); break;
- case RESOURCE_PLASMA: s = sprintf("%s and %d plasma", s, thisammo); break;
- case RESOURCE_FUEL: s = sprintf("%s and %d fuel", s, thisammo); break;
- }
+ float ownderammo = GetResource(own, ammotype);
+ float thisammo = min(ownderammo, GetResource(wep, ammotype));
+ SetResource(wep, ammotype, thisammo);
+ SetResource(own, ammotype, ownderammo - thisammo);