Quote:
Originally Posted by Trakan
This work thanks  .
I would put a limit-Standing for the charger. When the player shoots 5 balls, it must charge to fulfill its charger.
How can I do it?
|
You can simply add something like (not safe):
PHP Code:
//#CLIENTSIDE
function onWeaponFired() {
if (clientr.ammo > 0 && this.shootedtimes < 5) {
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");
this.shootedtimes ++; //increase the times the player fired the weapon
freezeplayer(0.75);
}
else {
player.chat = "No Ammo!";
this.shootedtimes = 0; //no ammo or player fired the weapon 5 times? Well than the counter goes back to 0
setani("reload", NULL);
}
}
or safe (just an example)
PHP Code:
function onActionServerSide() {
if (params[0] == "shootplus") {
if (clientr.firedtimes < 5) { //just an additional check (needed?)
clientr.firedtimes ++; //increase the times the player fired the weapon by 1
clientr.ammo --; //decrease the ammo by 1
}
}
if (params[0] == "shootminus") {
clientr.firedtimes = 0; //reset the shooting times
}
}
//#CLIENTSIDE
function onWeaponFired() {
if (clientr.ammo > 0 && clientr.firedtimes < 5) {
player.chat = "PENG!";
triggerserver("weapon", this.name, "shootplus");
freezeplayer(0.75);
}
else {
player.chat = "No peng :( let´s reload";
triggerserver("weapon", this.name, "shootminus");
}
}
Just something quick bumped