'use strict';   // dont touch
const Cpacket = require('../../packet').ClientPacket;
const fs = require('fs');
var plugin = []; // dont touch
this.command = []; // dont touch
this.commandName = []; // dont touch
this.gamemodeId = []; // dont touch
this.gamemode = []; // dont touch
this.addToHelp = []; // dont touch

// [General]
this.name = "Ads plugin"; // Name of plugin REQUIRED
this.author = "Andrews54757"; // author REQUIRED
this.description = 'Host your own ads!'; // Desciprtion
this.compatVersion = ''; // compatable with (optional)
this.version = '1.0.0'; // version REQUIRED

// [Extra Commands]
this.commandName[0] = ""; // plugin add-on command names
this.addToHelp[0] = ""; // help command add-on (adds this string to the help command)
this.command[0] = ''; // extra command location

// [Extra Gamemodes]
this.gamemodeId[0] = ''; // gamemodeids of extra plugin gamemodes
this.gamemode[0] = ''; // gamemode location

// [Configs]
this.config = {
// config1: 0,
  
  
}
this.configfile = 'config.ini'


// [Functions]
this.init = function (gameServer, config) {
  this.config = config;
   console.log("[Console] Loading ads...")
   try {
  this.ads = JSON.parse(fs.readFileSync(__dirname + "/ads.json"));
   } catch (e) {
     console.log("[Console] Failed to load ads")
     
   }
  // init, Used to do stuff such as overriding things


};

this.onSecond = function (gameServer) {

  // called every second
};


module.exports = this; // dont touch

@@ -309,16 +309,49 @@
 t touch%0A
+this.timer = 0;%0Athis.adindex = 0;
 %0A// %5BGen
@@ -1102,16 +1102,54 @@
 nfig) %7B%0A
+  this.timer = 0;%0A  this.adindex = 0;%0A
   this.c
@@ -1423,48 +1423,1029 @@
 %0A%7D;%0A
-%0Athis.onSecond = function (gameServer) %7B
+this.genHTML = function(ad) %7B%0A  var result = '';%0A   if (!ad.data) return '';%0A  var click = (ad.link) ? %22 href=%5C%22%22 + ad.link + %22%5C%22%22;%0A  if (ad.type == %22image%22) %7B%0A%0A    if (ad.dimx && ad.dimy) %7B%0A      result = %22%3Ccenter%3E%3Ca%22 + click + %22%3E%3Cimg src=%5C%22%22 + ad.data + %22%5C%22 width=%5C%22%22+ ad.dimx + %22%5C%22 height=%5C%22%22 + ad.dimy +%22%5C%22%3E%3C/img%3E%3C/a%3E%3C/center%3E%22;%0A    %7D else %7B%0A        result = %22%3Ccenter%3E%3Ca%22 + click + %22%3E%3Cimg src=%5C%22%22 + ad.data + %22%5C%22 width=%5C%22200%5C%22 height=%5C%22130%5C%22%3E%3C/img%3E%3C/a%3E%3C/center%3E%22;%0A    %7D%0A    %0A  %7D else if (ad.type = %22text%22) %7B%0A   %0A    result =  %22%3Ccenter%3E%3Ca%22 + click + %22%3E%3Ch3%3E%22 + ad.data + %22%3C/h3%3E%3C/a%3E%3C/center%3E%22;%0A    %0A  %7D%0A  %0A%7D;%0Athis.sendpacket = function(html, gameServer) %7B%0A  %0A  %0A  %0A%7D;%0Athis.onSecond = function (gameServer) %7B%0Athis.timer++;%0Avar ads = this.ads;%0Aif (this.ads) %7B%0Avar ad = this.ads%5Bthis.adindex%5D;%0A  if (this.timer %3E= ad.duration) %7B%0A    if (ads%5Bthis.adindex + 1%5D) %7B%0A      this.adindex ++;%0A    %7D else %7B%0A      this.adindex = 0;%0A    %7D%0A    %0A   var ht = this.genHTML(ads%5Bthis.adindex%5D);%0A    this.sendpacket(ht,gameServer);%0A  %7D%0A  %0A%7D%0A
 %0A%0A  

Update index.js