javascript help.

Discutii despre tot ce nu se incadreaza in celelalte categorii.

Moderators: Moderatori ajutatori, Moderatori

Post Reply
User avatar
alez112
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 945
Joined: 26 Sep 2012, 17:42
Detinator Steam: Da
Reputatie: Membru Club eXtreamCS (doua luni)
- 1 warn (2 luni club)
Restrictie mesaje private
Utilizator neserios (tepar!)
Location: Bucuresti

26 Apr 2016, 19:00

Cum pot face cand da disconnect sa dea reconnect iar?
PS: nu are legatura cu cs 1.6

| Afiseaza codul
bot.client.on('disconnect', function() {
            if (config.verbosityLevel > 0) {
                bot.log('Disconnected from the server.');
            }
            if (spawnCount > 0){ spawnCount--; bot_count--;}
            socket.emit("spawn-count", spawnCount + '/' + config.maxBots);
        });
HLDS Vulnerability
RoyalServer 2
The Kalu
Fost administrator
Fost administrator
Posts: 13712
Joined: 09 Oct 2010, 12:39
Detinator Steam: Da
CS Status: In grajd!
SteamID: kalulord
Reputatie: Fost Administrator
Fost membru Club eXtreamCS (6 luni)
Nume anterior: Terra
Location: Romania, Ploiesti
Has thanked: 328 times
Been thanked: 646 times
Contact:

26 Apr 2016, 19:08

bot.client.on('disconnect', function() {
if (config.verbosityLevel > 0) {
bot.log('Disconnected from the server.');
}
if (spawnCount > 0){ spawnCount--; bot_count--;}
socket.emit("spawn-count", spawnCount + '/' + config.maxBots);

socket.socket.reconnect();
});
sau in setarile de connect

'reconnect': true,
Image
User avatar
alez112
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 945
Joined: 26 Sep 2012, 17:42
Detinator Steam: Da
Reputatie: Membru Club eXtreamCS (doua luni)
- 1 warn (2 luni club)
Restrictie mesaje private
Utilizator neserios (tepar!)
Location: Bucuresti

26 Apr 2016, 19:24

[TypeError: Cannot read property 'reconnect' of undefined] nu functioneaza..
| Afiseaza codul
bot.client.on('connected', function() {
            bot.reset_map_data();
            if (config.verbosityLevel > 0) {
                bot.log('Connection Success, spawning');
            }
            bot.client.spawn(bot.nickname);
            spawnCount++;
            socket.emit("spawn-count", spawnCount + '/' + config.maxBots);
            //we will search for target to eat every 100ms
            bot.interval_id = setInterval(function() {
                bot.recalculateTarget();
            }, 100);
			interval_id2 = setInterval(function() {
                if(spawnCount==0 && reconnect==true) {
            reconnect = false;					
            bot_count=0;
			facebookManager.generateTokens(options, function() {
            console.log("Facebook token Successfully Checked..");
			});
			setTimeout(function() {
            startFeederBotOnProxies();
        }, 3000);
		}
            }, 100);
        });

        bot.client.on('mapSizeLoad', function(server_minx, server_miny, server_maxx, server_maxy) {
            //bot.log('got my map-size: ' + min_x + ";" + min_y + ";" + max_x + ";" + max_y);
            if (bot.valcompare(server_maxx - server_minx, server_maxy - server_miny)) {
              bot.real_minx = server_minx;
              bot.real_miny = server_miny;
              bot.real_maxx = server_maxx;
              bot.real_maxy = server_maxy;
            } else {
              if (bot.valcompare(server_minx, bot.lastsent.minx)) {
                if (0.01 < server_maxx - bot.lastsent.maxx || -0.01 > server_maxx - bot.lastsent.maxx) {
                  bot.real_minx = server_minx;
                  bot.real_maxx = server_minx + 14142.135623730952;
                }
              }
              if (0.01 < server_minx - bot.lastsent.minx || -0.01 > server_minx - bot.lastsent.minx) {
                if (bot.valcompare(server_maxx, bot.lastsent.maxx)) {
                  bot.real_maxx = server_maxx;
                  bot.real_minx = server_maxx - 14142.135623730952;
                }
              }
              if (0.01 < server_miny - bot.lastsent.miny || -0.01 > server_miny - bot.lastsent.miny) {
                if (bot.valcompare(server_maxy, bot.lastsent.maxy)) {
                  bot.real_maxy = server_maxy;
                  bot.real_miny = server_maxy - 14142.135623730952;
                }
              }
              if (bot.valcompare(server_miny, bot.lastsent.miny)) {
                if (0.01 < server_maxy - bot.lastsent.maxy || -0.01 > server_maxy - bot.lastsent.maxy) {
                  bot.real_miny = server_miny;
                  bot.real_maxy = server_miny + 14142.135623730952;
                }
              }
              if (server_minx < bot.real_minx) {
                bot.real_minx = server_minx;
                bot.real_maxx = server_minx + 14142.135623730952;
              }
              if (server_maxx > bot.real_maxx) {
                bot.real_maxx = server_maxx;
                bot.real_minx = server_maxx - 14142.135623730952;
              }
              if (server_miny < bot.real_miny) {
                bot.real_miny = server_miny;
                bot.real_maxy = server_miny + 14142.135623730952;
              }
              if (server_maxy > bot.real_maxy) {
                bot.real_maxy = server_maxy;
                bot.real_miny = server_maxy - 14142.135623730952;
              }
              bot.lastsent.minx = server_minx;
              bot.lastsent.miny = server_miny;
              bot.lastsent.maxy = server_maxy;
              bot.lastsent.maxx = server_maxx;
            }

            bot.offset_x = bot.real_minx || -7071;
            bot.offset_y = bot.real_miny || -7071;
        });

        bot.client.on('connectionError', function(e) {
            if (config.verbosityLevel > 0) {
                bot.log('Connection Failed: ' + e);
            }
        });

        bot.client.on('myNewBall', function(ball_id) {
            // Should always be generated.
            if (config.verbosityLevel > -1) {
                bot.log('New Cell Generated (' + ball_id + ')');
            }
        });

        bot.client.once('leaderBoardUpdate', function(old, leaders) {
            var name_array = leaders.map(function(ball_id) {
                return bot.client.balls[ball_id].name || 'unnamed'
            });
            if (config.verbosityLevel > 0) {
                bot.log('Server Leaderboard: ' + name_array.join(' - '));
            }
        });

        bot.client.on('somebodyAteSomething', function(eater_ball, eaten_ball) {
            var ball = bot.client.balls[eater_ball];
            if (!ball) return; //if we don't know that ball, we don't care
            if (!ball.mine) return; //if it's not our ball, we don't care
            //bot.client.log('I ate ' + eaten_ball + ', my new size is ' + ball.size);
        });

        bot.client.on('mineBallDestroy', function(ball_id, reason) { //when my ball destroyed
            if (reason.by) {
                if (config.verbosityLevel > 0) {
                    bot.log(bot.client.balls[reason.by] + ' has killed a cell.');
                }
            }

            if (reason.reason == 'merge') {
                if (config.verbosityLevel > 1) {
                    bot.log('Merged with another cell. Bot_' + ball_id + ' now has ' + bot.client.my_balls.length + ' balls.')
                }
            } else {
                if (config.verbosityLevel > 1) {
                    bot.log('Lost a cell! Bot_' + ball_id + ' has ' + bot.client.my_balls.length + ' cells left.');
                }
            }
        });

        bot.client.on('lostMyBalls', function() {
            if (config.verbosityLevel > 0) {
                bot.log('Respawning.');
            }
            bot.reset_map_data();
            bot.client.spawn(bot.nickname);
            bot.isOnFeedMission = false;
        });

        bot.client.on('disconnect', function() {
        if (config.verbosityLevel > 0) {
        bot.log('Disconnected from the server.');
        }
        if (spawnCount > 0){ spawnCount--; bot_count--;}
        socket.emit("spawn-count", spawnCount + '/' + config.maxBots);

        socket.socket.reconnect();
        });


Un rus avea ceva gen dar nu vrea sa dea scriptul complet.
| Afiseaza codul
bot.client.on('disconnect', function() {
            connectedBots--;
            bot.interval_id = false;
            //if (spawnCount > 0){ spawnCount--;}
            if (config.verbosityLevel > 0) {
                bot.log('Disconnected from the server.');
            }

            bot.hasSpawned = false;
            if (bot.hasSpawned && !disconnectingAll && (connectedBots < config.maxBots)) {
                bot.reconnect();
            }
Last edited by alez112 on 26 Apr 2016, 19:28, edited 1 time in total.
HLDS Vulnerability
The Kalu
Fost administrator
Fost administrator
Posts: 13712
Joined: 09 Oct 2010, 12:39
Detinator Steam: Da
CS Status: In grajd!
SteamID: kalulord
Reputatie: Fost Administrator
Fost membru Club eXtreamCS (6 luni)
Nume anterior: Terra
Location: Romania, Ploiesti
Has thanked: 328 times
Been thanked: 646 times
Contact:

26 Apr 2016, 19:28

alez112 wrote:[TypeError: Cannot read property 'reconnect' of undefined] nu functioneaza..
| Afiseaza codul
bot.client.on('connected', function() {
            bot.reset_map_data();
            if (config.verbosityLevel > 0) {
                bot.log('Connection Success, spawning');
            }
            bot.client.spawn(bot.nickname);
            spawnCount++;
            socket.emit("spawn-count", spawnCount + '/' + config.maxBots);
            //we will search for target to eat every 100ms
            bot.interval_id = setInterval(function() {
                bot.recalculateTarget();
            }, 100);
			interval_id2 = setInterval(function() {
                if(spawnCount==0 && reconnect==true) {
            reconnect = false;					
            bot_count=0;
			facebookManager.generateTokens(options, function() {
            console.log("Facebook token Successfully Checked..");
			});
			setTimeout(function() {
            startFeederBotOnProxies();
        }, 3000);
		}
            }, 100);
        });

        bot.client.on('mapSizeLoad', function(server_minx, server_miny, server_maxx, server_maxy) {
            //bot.log('got my map-size: ' + min_x + ";" + min_y + ";" + max_x + ";" + max_y);
            if (bot.valcompare(server_maxx - server_minx, server_maxy - server_miny)) {
              bot.real_minx = server_minx;
              bot.real_miny = server_miny;
              bot.real_maxx = server_maxx;
              bot.real_maxy = server_maxy;
            } else {
              if (bot.valcompare(server_minx, bot.lastsent.minx)) {
                if (0.01 < server_maxx - bot.lastsent.maxx || -0.01 > server_maxx - bot.lastsent.maxx) {
                  bot.real_minx = server_minx;
                  bot.real_maxx = server_minx + 14142.135623730952;
                }
              }
              if (0.01 < server_minx - bot.lastsent.minx || -0.01 > server_minx - bot.lastsent.minx) {
                if (bot.valcompare(server_maxx, bot.lastsent.maxx)) {
                  bot.real_maxx = server_maxx;
                  bot.real_minx = server_maxx - 14142.135623730952;
                }
              }
              if (0.01 < server_miny - bot.lastsent.miny || -0.01 > server_miny - bot.lastsent.miny) {
                if (bot.valcompare(server_maxy, bot.lastsent.maxy)) {
                  bot.real_maxy = server_maxy;
                  bot.real_miny = server_maxy - 14142.135623730952;
                }
              }
              if (bot.valcompare(server_miny, bot.lastsent.miny)) {
                if (0.01 < server_maxy - bot.lastsent.maxy || -0.01 > server_maxy - bot.lastsent.maxy) {
                  bot.real_miny = server_miny;
                  bot.real_maxy = server_miny + 14142.135623730952;
                }
              }
              if (server_minx < bot.real_minx) {
                bot.real_minx = server_minx;
                bot.real_maxx = server_minx + 14142.135623730952;
              }
              if (server_maxx > bot.real_maxx) {
                bot.real_maxx = server_maxx;
                bot.real_minx = server_maxx - 14142.135623730952;
              }
              if (server_miny < bot.real_miny) {
                bot.real_miny = server_miny;
                bot.real_maxy = server_miny + 14142.135623730952;
              }
              if (server_maxy > bot.real_maxy) {
                bot.real_maxy = server_maxy;
                bot.real_miny = server_maxy - 14142.135623730952;
              }
              bot.lastsent.minx = server_minx;
              bot.lastsent.miny = server_miny;
              bot.lastsent.maxy = server_maxy;
              bot.lastsent.maxx = server_maxx;
            }

            bot.offset_x = bot.real_minx || -7071;
            bot.offset_y = bot.real_miny || -7071;
        });

        bot.client.on('connectionError', function(e) {
            if (config.verbosityLevel > 0) {
                bot.log('Connection Failed: ' + e);
            }
        });

        bot.client.on('myNewBall', function(ball_id) {
            // Should always be generated.
            if (config.verbosityLevel > -1) {
                bot.log('New Cell Generated (' + ball_id + ')');
            }
        });

        bot.client.once('leaderBoardUpdate', function(old, leaders) {
            var name_array = leaders.map(function(ball_id) {
                return bot.client.balls[ball_id].name || 'unnamed'
            });
            if (config.verbosityLevel > 0) {
                bot.log('Server Leaderboard: ' + name_array.join(' - '));
            }
        });

        bot.client.on('somebodyAteSomething', function(eater_ball, eaten_ball) {
            var ball = bot.client.balls[eater_ball];
            if (!ball) return; //if we don't know that ball, we don't care
            if (!ball.mine) return; //if it's not our ball, we don't care
            //bot.client.log('I ate ' + eaten_ball + ', my new size is ' + ball.size);
        });

        bot.client.on('mineBallDestroy', function(ball_id, reason) { //when my ball destroyed
            if (reason.by) {
                if (config.verbosityLevel > 0) {
                    bot.log(bot.client.balls[reason.by] + ' has killed a cell.');
                }
            }

            if (reason.reason == 'merge') {
                if (config.verbosityLevel > 1) {
                    bot.log('Merged with another cell. Bot_' + ball_id + ' now has ' + bot.client.my_balls.length + ' balls.')
                }
            } else {
                if (config.verbosityLevel > 1) {
                    bot.log('Lost a cell! Bot_' + ball_id + ' has ' + bot.client.my_balls.length + ' cells left.');
                }
            }
        });

        bot.client.on('lostMyBalls', function() {
            if (config.verbosityLevel > 0) {
                bot.log('Respawning.');
            }
            bot.reset_map_data();
            bot.client.spawn(bot.nickname);
            bot.isOnFeedMission = false;
        });

        bot.client.on('disconnect', function() {
        if (config.verbosityLevel > 0) {
        bot.log('Disconnected from the server.');
        }
        if (spawnCount > 0){ spawnCount--; bot_count--;}
        socket.emit("spawn-count", spawnCount + '/' + config.maxBots);

        socket.socket.reconnect();
        });
Ai incercat cu reonnect true in fisierul unde se conecteaza?
Image
User avatar
alez112
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 945
Joined: 26 Sep 2012, 17:42
Detinator Steam: Da
Reputatie: Membru Club eXtreamCS (doua luni)
- 1 warn (2 luni club)
Restrictie mesaje private
Utilizator neserios (tepar!)
Location: Bucuresti

26 Apr 2016, 19:29

Iti trimit PM cu tot fisierul JS, vezi poate ma ai la block la PM.
si da am incercat..


Am tot incercat si tot nu merge.
HLDS Vulnerability
User avatar
alez112
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 945
Joined: 26 Sep 2012, 17:42
Detinator Steam: Da
Reputatie: Membru Club eXtreamCS (doua luni)
- 1 warn (2 luni club)
Restrictie mesaje private
Utilizator neserios (tepar!)
Location: Bucuresti

26 Apr 2016, 20:03

Am incercat si tot nu merge.
HLDS Vulnerability
Post Reply

Return to “Discutii generale”

  • Information