I have tried to fix up you're script.
Try this out.
PHP Code:
function onActionServerSide() {
if (params[0] == "deductammo") {
clientr.ammo -= 1;
}
if (params[0] == "add") {
clientr.ammo = 10;
player.attr[15] = "holst_usp45.png";
}
}
function onActionProjectile() {
player.hearts -= 6;
}
//#CLIENTSIDE
function onPlayerChats() {
if (player.chat == "/ammo") {
triggerserver("weapon", this.name, "add");
replaceani("walk", "holst_gunwalk");
replaceani("idle", "holst_gunidle");
player.chat == "Ammo Added!";
}
}
function onWeaponFired() {
if (clientr.ammo > 0) {
shoot(player.x + vecx(player.dir), player.y + vecy(player.dir), player.z, (playerdir + 1) * pi / 2, NULL, NULL, "holst_bullet", NULL);
setani("holst_gunfire", NULL);
triggerserver("weapon", this.name, "deductammo");
freezeplayer(0.75);
} else {
player.chat = "No Ammo!";
}
}
function onKeyPressed(code, key) {
if (key == "e") {
setani("holst_gunreload", NULL);
triggerserver("weapon", this.name, "reload");
}
}
Also why was there capacityammo, maxcapacityammo and ammo.
You only really need two..
clip and ammo, but for this script you only need ammo.