Advertisement
Guest User

ROBLOX MEssage

a guest
Feb 12th, 2016
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. // gg
  2. var placeId = 198817751; // Place to check and message
  3. var waitTime = 5; // In seconds
  4. var group = 0; // 0 for no group check, otherwise people in this group will not receive the message
  5. function sendMsg(userId, username) {
  6. function send() {
  7. $.post("http://www.roblox.com/messages/send",{
  8. subject: 'Republic of Benin',
  9. body: 'Hello, ' + username + '.\n\ I am recruiting you to join Benin! Benin is a currently growing nation everyday we currently have 100+ members and growing! Currently we have Military, Police and Government spots open that are free to join. It is all up to what you choose! Join today http://www.roblox.com/My/Groups.aspx?gid=1077937',
  10. recipientid: userId,
  11. cacheBuster: new Date().getTime()
  12. }).done(function(response) {
  13. if (response.success == true) {
  14. console.log('Sent message to ' + username + ' (' + userId + ')');
  15. } else {
  16. console.log('Error sending to ' + username + ': ' + response.shortMessage);
  17. }
  18. });
  19. }
  20. if (group > 0) {
  21. $.get("http://www.roblox.com/Game/LuaWebService/HandleSocialRequest.ashx?method=IsInGroup&playerid=" + userId + "&groupid=" + group, function(response) {
  22. if(response.indexOf('true') == -1) {
  23. send();
  24. } else {
  25. console.log('Didn\'t send a message to ' + username + ' because he is already in group ' + group + '.');
  26. }
  27. });
  28. } else {
  29. send();
  30. }
  31. }
  32.  
  33. var i=0;
  34. function run() {
  35. var timeout = 0;
  36. var url = "http://www.roblox.com/games/getgameinstancesjson?placeId=" + placeId +"&startindex=" + i*10;
  37. $.get(url).done(function(obj){
  38. for (var server in obj.Collection) {
  39. for (var players in obj.Collection[server].CurrentPlayers) {
  40. var plr = obj.Collection[server].CurrentPlayers[players];
  41. if (plr.Id > 0) {
  42. (function(time,id,name) {
  43. setTimeout(sendMsg,time,id,name);
  44. })(timeout,plr.Id,plr.Username);
  45. timeout+=waitTime*1000;
  46. }
  47. }
  48. }
  49. i++;
  50. setTimeout(run, timeout);
  51. });
  52. }
  53. run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement