number is not defined
I got this script but it doesnt recognize the commands i use.... Anybody can tell me what to do?
Code:/** * Created by Simon on 18.05.2014. */ var ID_TEXT = $.findPacketId("TEXT"); var ID_PLAYER_TEXT = $.findPacketId("PLAYERTEXT"); var talking = "" ; var boot = false; var playertextPacket = event.createPacket(ID_PLAYERTEXT); function onClientPacket(event) //Here, we handle all the packets we sent to the server { var packet = event.getPacket(); switch (packet.id()) { case ID_PLAYER_TEXT: { var text = packet.text.toLowerCase(); if (text.length() >= 6 && text.substring(0, 6) == "/start") { boot = true; talking = text.substring(7); spamify(); } else if (text == "/stop") { boot = false; } } } } function spamify() { if(boot) { var bing = this.rand(); playertextPacket.text = talking + bing; $.sendToServer(playertextPacket); $.scheduleEvent(5, "spamify"); // Calls itself in 5 seconds } } function rand() { number++; if (number % 2 == 0) { return "."; } else { return "!"; } }
"They say the best weapon is one you never have to fire.
I respectfully disagree.
I prefer the weapon you only have to fire once."
~ Tony Stark
number is not defined
Last edited by CrazyJani; 06-04-2014 at 05:00 AM.
Last edited by The_En|D; 06-04-2014 at 05:54 AM.
"They say the best weapon is one you never have to fire.
I respectfully disagree.
I prefer the weapon you only have to fire once."
~ Tony Stark
Take this out from the top:
And insert it into the spamify function:Code:var playertextPacket = event.createPacket(ID_PLAYERTEXT);
Code:function spamify() { if(boot) { var bing = this.rand(); var playertextPacket = event.createPacket(ID_PLAYERTEXT); playertextPacket.text = talking + bing; $.sendToServer(playertextPacket); $.scheduleEvent(5, "spamify"); // Calls itself in 5 seconds } }
IAmDM (06-04-2014)