· 9 years ago · Aug 30, 2017, 02:16 PM
1script options:
2 $ db url jdbc:mysql://172.16.0.1:3306/kitpvp_stats # // Host, Port (default: 3306), database
3 $ db username kitpvp_stats # // username for login
4 $ db password SIfZE1iiQRpUzzjk # // password for login
5command /freset:
6 trigger:
7 delete file "plugins/GG-KitPvP/NPC/Data.yml"
8 update "DROP table npc"
9 wait 1 second
10 update "CREATE TABLE IF NOT EXISTS `npc` (`UUID` varchar(255),`kills` mediumint(255))"
11 set {_num} to 0
12 loop all players:
13 update "INSERT INTO `npc` (`uuid`, `kills`) VALUES ('%uuid of loop-player%', '%{_num}%')"
14 set yaml value "mysql.%uuid of loop-player%" from file "../../GG-KitPvP/NPC/Data.yml" to true
15 set {npc::1d.sec} to 59
16 set {npc::1d.min} to 59
17 set {npc::1d.tim} to 23
18every 1 second:
19 if {npc::1d.min} is 0:
20 set {npc::1d.min} to 59
21 remove 1 from {npc::1d.tim}
22 if {npc::1d.sec} is 0:
23 set {npc::1d.sec} to 60
24 remove 1 from {npc::1d.min}
25 remove 1 from {npc::1d.sec}
26 set {_loc} to yaml value "skilt" from file "../../GG-KitPvP/NPC/1d.yml"
27 set line 2 of block at {_loc} to "&c%{npc::1d.tim}%&8:&c%{npc::1d.min}%&8:&c%{npc::1d.sec}%"
28every 30 minute:
29 set {_clock} to hour
30 if {_clock} is 1:
31 delete file "plugins/GG-KitPvP/NPC/Data.yml"
32 update "DROP table npc"
33 wait 1 second
34 set {_num} to 0
35 update "CREATE TABLE IF NOT EXISTS `npc` (`UUID` varchar(255),`kills` mediumint(255))"
36 loop all players:
37 update "INSERT INTO `npc` (`uuid`, `kills`) VALUES ('%uuid of loop-player%', '%{_num}%')"
38 set yaml value "mysql.%uuid of loop-player%" from file "../../GG-KitPvP/NPC/Data.yml" to true
39 set {npc::1d.sec} to 59
40 set {npc::1d.min} to 59
41 set {npc::1d.tim} to 23
42on join:
43 delete {_mysql}
44 set {_mysql} to yaml value "mysql.%uuid of player%" from file "../../GG-KitPvP/NPC/Data.yml"
45 if {_mysql} is true:
46 stop
47 else:
48 set {_num} to 0
49 update "INSERT INTO `npc` (`uuid`, `kills`) VALUES ('%uuid of player%', '%{_num}%')"
50 set yaml value "mysql.%uuid of player%" from file "../../GG-KitPvP/NPC/Data.yml" to true
51
52on death:
53 if victim is a pig:
54 stop
55 victim is a player
56 if attacker is a player:
57 set {_kills} to yaml value "kills.%uuid of attacker%" from file "../../GG-KitPvP/NPC/Data.yml"
58 add 1 to {_kills}
59 set yaml value "kills.%uuid of attacker%" from file "../../GG-KitPvP/NPC/Data.yml" to {_kills}
60# send "&4&lDEBUG &8&l> &c%{_kills}% ((Død))" to all ops
61
62
63on quit:
64 set {_kills} to yaml value "kills.%uuid of player%" from file "../../GG-KitPvP/NPC/Data.yml"
65 update "UPDATE `npc` SET `kills` = '%{_kills}%' WHERE `npc`.`uuid` ='%uuid of player%'"
66 send "Opdaterede %player% ((%uuid of player%)) med databasen!"
67# send "&4&lDEBUG &8&l> &c%{_kills}% ((Quit))" to all ops
68
69on sign change:
70 line 1 is "NPC"
71 line 2 is "1dkills"
72 set {_loc} to location of event-block
73 set yaml value "skilt" from file "../../GG-KitPvP/NPC/1d.yml" to {_loc}
74 set line 1 of event-block to "&3&lTop Kills"
75 set line 2 of event-block to "&c00&8:&c00&8:&c00"
76 set line 3 of event-block to "&bIngen..."
77 set line 4 of event-block to "&c0 kills"
78 console command "npc sel 103"
79 console command "npc skin steve"
80 console command "npc rename Vent..."
81on rightclick on a sign:
82 line 1 is "&3&lTop Kills"
83 player command "top1dkillsnpc"
84
85command /top1dkillsnpc:
86 trigger:
87 open chest with 1 row named "&6&lTop Kills" to player
88 set {_n} to 0
89 wait 2 ticks
90 loop 9 times:
91 set {_show} to yaml value "top.%{_n}%" from file "../../GG-KitPvP/NPC/Data.yml"
92 set {_player} to yaml value "top.navn.%{_n}%" from file "../../GG-KitPvP/NPC/Data.yml"
93 set slot {_n} of player's current inventory to {_player}'s skull named "%{_show}%"
94 add 1 to {_n}
95
96
97
98command /forceupdate1dkillsnpc:
99 permission: ggpvp.admin
100 trigger:
101 set {_id0::*} to objects in column "uuid" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 0"
102 $ thread
103 set {_id1::*} to objects in column "uuid" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 1"
104 $ thread
105 set {_id2::*} to objects in column "uuid" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 2"
106 $ thread
107 set {_id3::*} to objects in column "uuid" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 3"
108 $ thread
109 set {_id4::*} to objects in column "uuid" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 4"
110 $ thread
111 set {_id5::*} to objects in column "uuid" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 5"
112 $ thread
113 set {_id6::*} to objects in column "uuid" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 6"
114 $ thread
115 set {_id7::*} to objects in column "uuid" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 7"
116 $ thread
117 set {_id8::*} to objects in column "uuid" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 8"
118 $ thread
119 set {_id9::*} to objects in column "uuid" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 9"
120 $ thread
121 set {_statsn0::*} to objects in column "kills" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 0"
122 $ thread
123 set {_statsn1::*} to objects in column "kills" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 1"
124 $ thread
125 set {_statsn2::*} to objects in column "kills" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 2"
126 $ thread
127 set {_statsn3::*} to objects in column "kills" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 3"
128 $ thread
129 set {_statsn4::*} to objects in column "kills" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 4"
130 $ thread
131 set {_statsn5::*} to objects in column "kills" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 5"
132 $ thread
133 set {_statsn6::*} to objects in column "kills" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 6"
134 $ thread
135 set {_statsn7::*} to objects in column "kills" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 7"
136 $ thread
137 set {_statsn8::*} to objects in column "kills" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 8"
138 $ thread
139 set {_statsn9::*} to objects in column "kills" from result of query "SELECT * FROM `npc` ORDER BY `kills` DESC LIMIT 1 OFFSET 9"
140 set {_n} to 0
141 set {_n1} to 1
142 loop 10 times:
143 set {_navn::*} to "Ingen..."
144 set {_name} to "Ingen..."
145 set {_kills::*} to 0
146 set {_navn::*} to yaml value "navn" from file "../../GG-KitPvP/uuid/%{_id%{_n}%::*}%.yml"
147 set {_kills::*} to {_statsn%{_n}%::*}
148 set {_name} to "%{_navn::*}%" parsed as a offlineplayer
149 set yaml value "top.%{_n}%" from file "../../GG-KitPvP/NPC/Data.yml" to "&8[&a%{_n1}%&8] &6%{_navn::*}% &8» &c%{_kills::*}%"
150 set yaml value "top.navn.%{_n}%" from file "../../GG-KitPvP/NPC/Data.yml" to {_name}
151 add 1 to {_n}
152 add 1 to {_n1}
153 set {_name} to yaml value "top.navn.0" from file "../../GG-KitPvP/NPC/Data.yml"
154 console command "npc sel 103"
155 console command "npc skin %{_name}%"
156 console command "npc rename &e%{_name}%"
157 set {_loc} to yaml value "skilt" from file "../../GG-KitPvP/NPC/1d.yml"
158 set {_p} to yaml value "uuid" from file "../../GG-KitPvP/uuid/%{_name}%.yml"
159 set {_kills} to yaml value "kills.%uuid of player%" from file "../../GG-KitPvP/NPC/Data.yml"
160 set line 4 of block at {_loc} to "&c%{_kills}% kills"