Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Config
- // To Use This Script You Must Make A Configuration File Called kits.txt and input your config, an example config is linked linked on AutisticScripts.xyz/ukits.html
- UseKitsPlugins = true;
- // Script
- KitInfo = array();
- pageData = array();
- kitNamesDescription = array();
- error = false;
- event onLoad(){
- file = file.read("kits.txt").split(",");
- amount = file.count / 5;
- if(isInt(amount)){
- error = false;
- server.log("uKits Configuration Correct!");
- count = 0;
- while(count != amount){
- KitInfo.add(array(file[count * 5 + 0], file[count * 5 + 1], file[count * 5 + 2], file[count * 5 + 3], file[count * 5 + 4]));
- count = count + 1;
- }
- foreach (val in KitInfo){
- kitNamesDescription.add("<color=" + val[0] + ">" + val[2] + "</color> \n" + val[3]);
- }
- count2 = 0;
- while(count2 != 8){
- KitInfo.add("Empty");
- kitNamesDescription.add("Empty");
- count2 = count2 + 1;
- }
- }
- else{
- server.log("uKits Configuration Incorrect!");
- error= true;
- }
- }
- command uKits(){
- permission = "uKits";
- execute(){
- foreach(val in pageData){
- if(val[0] == player.id){
- pageData.remove(val);
- }
- }
- pageData.add(array(player.id, 0));
- effectManager.clearUIbyID(3805, player.id);
- effectManager.clearUIbyID(3806, player.id);
- effectManager.sendUI(3805, 3805, player.id, kitNamesDescription[0], kitNamesDescription[1], kitNamesDescription[2], kitNamesDescription[3));
- effectManager.sendUI(3806, 3806, player.id, kitNamesDescription[4], kitNamesDescription[5], kitNamesDescription[6], kitNamesDescription[7]);
- }
- }
- command ut(){
- execute(){
- foreach(val in pageData){
- player.message(val[0] + " - " + val[1]);
- }
- }
- }
- function buttonClicked(player, optionNumber){
- optionNumberOneLess = optionNumber - 1;
- caller = player;
- c=0;
- foreach(page in pageData){
- if(c == 0){
- if(page[0] == caller.id){
- c=1;
- pages = page[1];
- targetnumber = toInt(pages * 8 + optionNumberOneLess);
- target = kitNamesDescription[targetnumber];
- if(target == "Empty"){
- player.message("Kit Not Found");
- }
- else{
- kitTarget = KitInfo[targetnumber];
- if(caller.hasPermission(kitTarget[1])){
- player.sudo("/kit " + kitTarget[4]);
- }
- else{
- player.message("You do not have Permissions");
- }
- }
- }
- }
- }
- }
- event onEffectButtonClicked(player, key){
- caller = player;
- if(key == "uKits_Item1"){
- buttonClicked(player, 1);
- }
- else if(key == "uKits_Item2"){
- buttonClicked(player, 2);
- }
- else if(key == "uKits_Item3"){
- buttonClicked(player, 3);
- }
- else if(key == "uKits_Item4"){
- buttonClicked(player, 4);
- }
- else if(key == "uKits_Item5"){
- buttonClicked(player, 5);
- }
- else if(key == "uKits_Item6"){
- buttonClicked(player, 6);
- }
- else if(key == "uKits_Item7"){
- buttonClicked(player, 7);
- }
- else if(key == "uKits_Item8"){
- buttonClicked(player, 8);
- }
- else if(key == "uKits_Previous"){
- foreach(page in pageData){
- if(page[0] == caller.id){
- pages = page[1] * 8;
- count = math.ceil(KitInfo.count / 8) - 1;
- if(page[0] == caller.id and page[1] > 0){
- page[1] = page[1] - 1;
- pages = page[1];
- player1 = pages * 8 + 0;
- player2 = pages * 8 + 1;
- player3 = pages * 8 + 2;
- player4 = pages * 8 + 3;
- player5 = pages * 8 + 4;
- player6 = pages * 8 + 5;
- player7 = pages * 8 + 6;
- player8 = pages * 8 + 7;
- effectManager.sendUI(3805, 3805, caller.id, kitNamesDescription[toInt(player1)], kitNamesDescription[toInt(player2)], kitNamesDescription[toInt(player3)], kitNamesDescription[toInt(player4)]);
- effectManager.sendUI(3806, 3806, caller.id, kitNamesDescription[toInt(player5)], kitNamesDescription[toInt(player6)], kitNamesDescription[toInt(player7)], kitNamesDescription[toInt(player8)]);
- return;
- }
- }
- }
- }
- else if(key == "uKits_Next"){
- foreach(page in pageData){
- if(page[0] == caller.id){
- pages = page[1] * 8;
- count = math.ceil(KitInfo.count / 8) - 1;
- if(page[0] == caller.id and page[1] < count){
- page[1] = toNumber(page[1]) + 1;
- pages = page[1];
- player1 = pages * 8 + 0;
- player2 = pages * 8 + 1;
- player3 = pages * 8 + 2;
- player4 = pages * 8 + 3;
- player5 = pages * 8 + 4;
- player6 = pages * 8 + 5;
- player7 = pages * 8 + 6;
- player8 = pages * 8 + 7;
- effectManager.sendUI(3805, 3805, caller.id, kitNamesDescription[toInt(player1)], kitNamesDescription[toInt(player2)], kitNamesDescription[toInt(player3)], kitNamesDescription[toInt(player4)]);
- effectManager.sendUI(3806, 3806, caller.id, kitNamesDescription[toInt(player5)], kitNamesDescription[toInt(player6)], kitNamesDescription[toInt(player7)], kitNamesDescription[toInt(player8)]);
- return;
- }
- }
- }
- }
- else if(key == "uKits_Close"){
- effectManager.clearUIbyID(3805, player.id);
- effectManager.clearUIbyID(3806, player.id);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement