Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // uPickPocket
- // This script is created by FOXTRISTAN#3671
- // CONFIGURATION
- allowed_groups = array(); // IN THIS CASE ALL GROUPS ARE ALLOWED
- // ALLOW ROCKET GROUP TO STEAL | EXAMPLE : allowed_groups = array("bandit", "mafia");
- restricted_items = array();
- // ADD ITEMS ID YOU WANT TO RESTRICT FROM BEING STOLE. | EXAMPLE : restrited = array(15, 81, 243);
- warn_msg = "";
- // THIS MESSAGE IS SENT TO THE TARGET WHEN AN ITEM IS STOLEN. | EXAMPLE : warn_msg = "Someone stole from you!";
- steal_msg = "You stole an item";
- // THIS MESSAGE APPEARS IS SENT TO THE PERSON STEALING WHEN HE IS STEALING AN ITEM. | EXAMPLE : steal_msg = "Great Job, you stole an item";
- steal_distance = 3;
- // DISTANCE BETWEEN THE STEALER AND THE VICTIM. | EXAMPLE : steal_distance = 5;
- nothing_msg = "";
- // THIS MESSAGE APPEARS WHEN TARGET HAS NOTHING TO BE STOLEN. | EXAMPLE : nothing_msg = "He has nothing for you to steal!";
- cooldown_time = 30;
- // COOLDOWN TIME IN SECONDS BEFORE PLAYER CAN PICKPOCKET AGAIN. | EXAMPLE : cooldown_time = "120";
- // SCRIPT
- try = 0;
- cooldown = array();
- event onPlayerGestured(player, gesture){
- if(gesture == "Point"){
- if(cooldown.contains(player.id) == false){
- if(inGroup(player) == true){
- if(player.stance == "CROUCH"){
- target = player.look.getPlayer();
- if(isSet(target)){
- if(v3.distance(target.position, player.position) < steal_distance){
- item = randomItem(target);
- if(item == null){
- if(nothing_msg != ""){
- player.message(nothing_msg);
- return;
- }else{
- return;
- }
- }
- if(steal_msg != ""){
- player.message(steal_msg);
- }
- if(warn_msg != ""){
- target.message(warn_msg);
- }
- cooldown.add(player.id);
- if(cooldown_time > 0){
- wait.seconds(cooldown_time, cooldown.remove(player.id));
- }
- player.inventory.addItem(item.id, 1);
- target.inventory.removeItem(item.id, 1);
- }
- }
- }
- }
- }
- }
- }
- function randomItem(target){
- inv = target.inventory.items;
- if(inv.count == 0){
- return null;
- }
- if(try >= 6){
- return null;
- }
- item = inv[random.int(0, inv.count)];
- if(restricted_items.contains(item.id)){
- if(inv.count == 1){
- return null;
- }
- try = try + 1;
- return randomItem(target);
- }else{
- return item;
- }
- }
- function inGroup(player){
- inG = false;
- if(allowed_groups.count == 0){
- return true;
- }
- foreach(group in allowed_groups){
- if(player.hasGroup(group)){
- inG = true;
- }
- }
- if(inG == true){
- return true;
- }else{
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment