Advertisement
AutismAlex

Untitled

Nov 5th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. // uPickPocket
  2.  
  3. // This script is created by FOXTRISTAN#3671
  4.  
  5. // CONFIGURATION
  6.  
  7. allowed_groups = array(); // IN THIS CASE ALL GROUPS ARE ALLOWED
  8. // ALLOW ROCKET GROUP TO STEAL | EXAMPLE : allowed_groups = array("bandit", "mafia");
  9.  
  10. restricted_items = array();
  11. // ADD ITEMS ID YOU WANT TO RESTRICT FROM BEING STOLE. | EXAMPLE : restrited = array(15, 81, 243);
  12.  
  13. warn_msg = "";
  14. // THIS MESSAGE IS SENT TO THE TARGET WHEN AN ITEM IS STOLEN. | EXAMPLE : warn_msg = "Someone stole from you!";
  15.  
  16. steal_msg = "You stole an item";
  17. // THIS MESSAGE APPEARS IS SENT TO THE PERSON STEALING WHEN HE IS STEALING AN ITEM. | EXAMPLE : steal_msg = "Great Job, you stole an item";
  18.  
  19. steal_distance = 3;
  20. // DISTANCE BETWEEN THE STEALER AND THE VICTIM. | EXAMPLE : steal_distance = 5;
  21.  
  22. nothing_msg = "";
  23. // THIS MESSAGE APPEARS WHEN TARGET HAS NOTHING TO BE STOLEN. | EXAMPLE : nothing_msg = "He has nothing for you to steal!";
  24.  
  25. cooldown_time = 30;
  26. // COOLDOWN TIME IN SECONDS BEFORE PLAYER CAN PICKPOCKET AGAIN. | EXAMPLE : cooldown_time = "120";
  27.  
  28. // SCRIPT
  29.  
  30. try = 0;
  31. cooldown = array();
  32.  
  33. event onPlayerGestured(player, gesture){
  34. if(gesture == "Point"){
  35. if(cooldown.contains(player.id) == false){
  36. if(inGroup(player) == true){
  37. if(player.stance == "CROUCH"){
  38. target = player.look.getPlayer();
  39. if(isSet(target)){
  40. if(v3.distance(target.position, player.position) < steal_distance){
  41. item = randomItem(target);
  42. if(item == null){
  43. if(nothing_msg != ""){
  44. player.message(nothing_msg);
  45. return;
  46. }else{
  47. return;
  48. }
  49. }
  50. if(steal_msg != ""){
  51. player.message(steal_msg);
  52. }
  53. if(warn_msg != ""){
  54. target.message(warn_msg);
  55. }
  56. cooldown.add(player.id);
  57. if(cooldown_time > 0){
  58. wait.seconds(cooldown_time, cooldown.remove(player.id));
  59. }
  60. player.inventory.addItem(item.id, 1);
  61. target.inventory.removeItem(item.id, 1);
  62. }
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }
  69.  
  70. function randomItem(target){
  71. inv = target.inventory.items;
  72. if(inv.count == 0){
  73. return null;
  74. }
  75. if(try >= 6){
  76. return null;
  77. }
  78. item = inv[random.int(0, inv.count)];
  79. if(restricted_items.contains(item.id)){
  80. if(inv.count == 1){
  81. return null;
  82. }
  83. try = try + 1;
  84. return randomItem(target);
  85. }else{
  86. return item;
  87. }
  88. }
  89.  
  90. function inGroup(player){
  91. inG = false;
  92. if(allowed_groups.count == 0){
  93. return true;
  94. }
  95. foreach(group in allowed_groups){
  96. if(player.hasGroup(group)){
  97. inG = true;
  98. }
  99. }
  100. if(inG == true){
  101. return true;
  102. }else{
  103. return false;
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement