Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Scripted by iMagic
- findplayer("Graal2007722").addweapon(this.name);
- this.image = "era_fuubaz-energyrifle-icon.png";
- //#CLIENTSIDE
- function onCreated() {
- this.image = "era_fuubaz-energyrifle-icon.png";
- // GANIS
- this.gun_idle = "mm_imagic-fuubaz-energyrifle-idle";
- this.gun_walk = "mm_imagic-fuubaz-energyrifle-walk";
- this.gun_fire = "mm_imagic-fuubaz-energyrifle-fire";
- this.gun_reload = "mm_imagic-fuubaz-energyrifle-reload";
- this.gun_bullet = "mm_imagic-fuubaz-energyrifle-bullet";
- // STATS
- this.gun_damage = 10;
- this.gun_firerate = 0.45;
- this.gun_freeze = 0.1;
- this.gun_spread = 0.07;
- this.gun_reloadclipsize = 14;
- this.gun_clipsize = 14;
- this.gun_reloadtime = 0.8;
- this.gun_bulletpos = {{-0.6, -1.7},{-2.2, -0.35},{0.6, 1.1},{2.4,-0.7}};
- }
- function onKeyPressed(code, key) {
- if (player.weapon == this.name) {
- if (key == "2") {
- if (!this.isGunEquipped) {
- this.isGunEquipped = true;
- player.chat = "*Plasma Rifle Equipped*";
- player.ani = this.gun_reload;
- replaceani("idle", this.gun_idle);
- replaceani("walk", this.gun_walk);
- } else {
- this.isGunEquipped = false;
- player.ani = "idle";
- player.chat = "*Unequipped*";
- replaceani("idle", "idle");
- replaceani("walk", "walk");
- }
- freezeplayer(0.5);
- }
- if (this.isGunEquipped) {
- if (key == "d") {
- if (!this.isReloading) {
- if (this.gun_clipsize >= 1) {
- if (!this.isShooting) {
- this.isShooting = true;
- player.ani = this.gun_fire;
- temp.angle = getangle(vecx(player.dir), vecy(player.dir)) + random(-this.gun_spread, this.gun_spread);
- setshootparams(this.gun_damage, player.account, "sys_health");
- shoot(player.x + this.gun_bulletpos[player.dir][0], player.y + this.gun_bulletpos[player.dir][1], player.z, temp.angle, 0, 0, this.gun_bullet, "");
- freezeplayer(this.gun_freeze);
- this.gun_clipsize -= 1;
- player.chat = "Clip: " @ this.gun_clipsize @ "/" @ this.gun_reloadclipsize;
- setTimer(this.gun_firerate);
- }
- } else {
- onStartReload();
- }
- }
- }
- }
- }
- }
- function onStartReload() {
- this.isReloading = true;
- freezeplayer(this.gun_reloadtime);
- player.ani = this.gun_reload;
- this.gun_clipsize = this.gun_reloadclipsize;
- scheduleEvent(this.gun_reloadtime, "onEndReload", "");
- }
- function onEndReload() {
- this.isReloading = false;
- }
- function onTimeout() {
- this.isShooting = false;
- }
Add Comment
Please, Sign In to add comment