DudeWithName

ProximityVoice

Jun 22nd, 2021
883
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // sorry for shit code but i forgot everything about uscript
  2.  
  3. uiIds = {
  4.     "whisper" : 31931,
  5.     "speak" : 31932,
  6.     "shout" : 31933,
  7. };
  8.  
  9. range = {
  10.     "whisper" : 30,
  11.     "speak" : 50,
  12.     "shout" : 100
  13. };
  14.  
  15. rangeNum = {
  16.     "30" : "whisper",
  17.     "50" : "speak",
  18.     "100" : "shout"
  19. };
  20.  
  21. event onLoad(){
  22.     proximityVoice.defaultRange = range["speak"];
  23.     logger.log("default range is set to " + proximityVoice.defaultRange.toString() );
  24. }
  25. event onPlayerJoined(player){
  26.     //Player Range is set to default when player joins
  27.     id = proximityVoice.getPlayerVoiceDistance(player.id).toString();
  28.     effectManager.sendUI(uiIds[rangeNum[id]], 69, player.id);
  29.     effectManager.sendUI(31930, 420, player.id);
  30. }
  31.  
  32. command voicemode(distance){
  33.     permission = "voice.changevoice";
  34.     allowedCaller = "player";
  35.     execute(){
  36.         if(range.containsKey(distance)){
  37.             oldId = proximityVoice.getPlayerVoiceDistance(player.id).toString();
  38.             effectManager.clearUIById(uiIds[rangeNum[oldId]], player.id);
  39.  
  40.             proximityVoice.changeVoiceDistance(player.id, range.get(distance));
  41.             effectManager.sendUI(uiIds[distance], 69, player.id);
  42.  
  43.             player.message("You've successfuly change your voicemode to " + distance.toString(), "#38eb68");
  44.         }
  45.         else{
  46.             player.message("Couldn't find voicemode " + distance.toString(), "#eb3844");
  47.         }
  48.     }
  49. }
RAW Paste Data