I'm working on a couple vehicles for some TC mods, and I'd like to be able to have the weapons on these vehicles stop firing after a set number of rounds, then simulate a reload.
Basically, it would:
1) Count how many seconds the weapon has been fired (a variable called "firetime"). Basically, each time the player presses Fire, a timer runs until Fire is released.
2) Once "firetime" is greater than a set amount ("ammolimit") the weapon stops firing and a "weaponactive" var is set to false.
3) A new timer runs for a certain amount of seconds ("reloadtime"). I trigger a sound and maybe an animation.
4) Once the timer reaches "reloadtime", "firetime" is reset to 0, "weaponactive" is set to true, and the weapon resumes firing.
I haven't coded anything relatively complex in a long time, so I really need some help with this.
Basically, it would:
1) Count how many seconds the weapon has been fired (a variable called "firetime"). Basically, each time the player presses Fire, a timer runs until Fire is released.
2) Once "firetime" is greater than a set amount ("ammolimit") the weapon stops firing and a "weaponactive" var is set to false.
3) A new timer runs for a certain amount of seconds ("reloadtime"). I trigger a sound and maybe an animation.
4) Once the timer reaches "reloadtime", "firetime" is reset to 0, "weaponactive" is set to true, and the weapon resumes firing.
I haven't coded anything relatively complex in a long time, so I really need some help with this.
Comment