Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Change placeId to the place you want to scan for and message players.
- Inspect Element->Console and copy and paste the code.
- Wait time can be adjusted and the bot will attempt to send messages super fast, but it's good to keep the time high or ROBLOX will detect flooding.
- You can change the group number to the group you are recruiting for so that it doesn't send the message to people in that group.
- */
- var placeId = 347401822; // Place to check and message
- var waitTime = 5; // In seconds
- var group = 0; // 0 for no group check, otherwise people in this group will not receive the message
- function action(userId, username) {
- follow(userId, function() {
- sendMsg(userId, username);
- });
- }
- function follow(userId, callback) {
- $.post('/user/follow', {targetUserId: userId}, callback);
- }
- function sendMsg(userId, username) {
- function send() {
- $.post('/messages/send',{
- subject: 'This is a test',
- body: 'Hello, ' + username + '.\n\nu ok m9?????',
- recipientid: userId,
- cacheBuster: new Date().getTime()
- }).done(function(response) {
- if (response.success == true) {
- console.log('Sent message to ' + username + ' (' + userId + ')');
- } else {
- console.log('Error sending to ' + username + ': ' + response.shortMessage);
- }
- });
- }
- if (group > 0) {
- $.get('/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=' + userId + '&groupid=' + group, function(response) {
- if(response.indexOf('true') == -1) {
- send();
- } else {
- console.log('Didn\'t send a message to ' + username + ' because he is already in group ' + group + '.');
- }
- });
- } else {
- send();
- }
- }
- var i=0;
- function run() {
- var timeout = 0;
- var url = '/games/getgameinstancesjson?placeId=' + placeId +'&startindex=' + i*10;
- $.get(url).done(function(obj){
- for (var server in obj.Collection) {
- for (var players in obj.Collection[server].CurrentPlayers) {
- var plr = obj.Collection[server].CurrentPlayers[players];
- if (plr.Id > 0) {
- (function(time,id,name) {
- setTimeout(action,time,id,name);
- })(timeout,plr.Id,plr.Username);
- timeout+=waitTime*1000;
- }
- }
- }
- i++;
- setTimeout(run, timeout);
- });
- }
- run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement