Onenrico

Deluxe Sell

May 20th, 2016
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.87 KB | None | 0 0
  1. #Skript Make By Enrico Fajar Ferdiansyah
  2. #No Copy Right Please :) ?
  3. #
  4. #Depencies:
  5. #- Skript
  6. #- Skquery
  7. #- Skrayfall
  8. #- Citizens
  9. #- Vault
  10.  
  11. #Tutorial [ADMIN]
  12. #1. Command /ds create <NamaNPC> <NPCMessage>
  13. #2. Hold Item to add it to Sell able in the NPC
  14. #3. Rightclick on The NPC then the item should be added on list sellable items
  15. #4. Test it by putting the item on the blank center of the GUI
  16. #5. Click The Green Wool then the item should be sold
  17.  
  18. #Tutorial [MEMBER]
  19. #1. Right Click To The NPC
  20. #2. Put Item To The Blank Center Of The GUI
  21. #3. CLick The Green WOOL !
  22.  
  23. #INFO:
  24. #Max sellable item in one npc = 8 different
  25. #No rename NPC ! No Edit Item in the NPC , if you get wrong item , just delete the npc by /ds delete
  26. #gunakan /ds untuk melihat list command
  27. #Support all Custom Items !
  28.  
  29. options:
  30. pref: &r &r%{_c3}%
  31. pref2: &8&l[%{_c5}%>&8&l]%{_c2}%
  32. versi: 1.1
  33.  
  34. #Message Section
  35. dscreate: /ds create <NPCname> <NPCMessage> &8- %{_c4}%Create New NPC
  36. dsdelete: /ds delete <NPCname> &8- %{_c4}%Delete An NPC
  37. dstype: /ds type <NPCname> <Type> &8- %{_c4}%Change Type Of Npc
  38. dsadd: /ds add <NPCname> <Price> &8- %{_c4}%Add Item To Sellable In NPC
  39. dsinfo: /ds info <NPCname> &8- %{_c4}%Info Of An NPC
  40. dslist: /ds list &8- %{_c4}%List Of all Registered NPC
  41. dsreload: /ds reload &8- %{_c4}%Reload The Skript
  42. dserrname: Please Insert NPC Name
  43. dserrprice: Please Insert Item Price
  44. dserronepiece: Please Hold Just One Item (Not Stack)
  45. dserrair: Please Hold An item To sellable
  46. dserrmsg: Please Insert NPC Message
  47. dserritemext: This Item Already Exist In This NPC
  48. dserrnameexs: Npc With That Name Already Exist
  49. dserranother: Please Pick Another Name Instead
  50. dsnpccreated: Npc With Name %{_c1}%%arg 2% %{_c3}%Succesfully Created
  51. dsnpcmsg: Npc Message For %{_c1}% %{_c3}%This NPC is &e""%{_c2}%%arg 3%&e""
  52. dsnpcnotfound: There's No NPC named %{_c1}%%arg 2%
  53. dsnpcdeleted: Npc Named %{_c4}%%arg 2% %{_c3}%Succesfully Deleted
  54. dsnonpc: None Npc has been created
  55. dscreatepls: Please Create One using
  56. dsnpclists: %{_c4}%List Of Deluxe Sell NPC created
  57. dsnoitem: There is no item sell on this NPC
  58. dsitemlists: List OF Sellable Item On This NPC
  59. #Message Section
  60.  
  61. #
  62. #
  63. #Jangan Ganti Dibawah Ini
  64. npcvar: {ds.npc::*}
  65. npcvarl: {ds.npc::%{_s}%}
  66. itemvar: {ds.item.%loop-value%::*}
  67. #Jangan Ganti Diatas Ini
  68. #
  69. #
  70.  
  71. on script load:
  72. send "&7[&6Skript&7] &aDeluxeSell &7V.{@versi} &fActivated" to console
  73. on script unload:
  74. send "&7[&6Skript&7] &cDeluxeSell &7V.{@versi} &fDisabled" to console
  75. command /deluxesell [<text>] [<text>] [<text>]:
  76. aliases: ds
  77. trigger:
  78. add "a" to {_list::*}
  79. add "b" to {_list::*}
  80. add "c" to {_list::*}
  81. add "6" to {_list::*}
  82. add "d" to {_list::*}
  83. add "f" to {_list::*}
  84. add "3" to {_list::*}
  85. add "e" to {_list::*}
  86. loop 5 times:
  87. set {_c%loop-num%} to "&%a random element out of {_list::*}%"
  88. set {_c%loop-num%} to colored {_c%loop-num%}
  89. if player don't have permission "deluxeshop.admin":
  90. send "{@pref2} Kamu Tidak Mempunyai Hak"
  91. stop
  92. if arg 1 is "reset":
  93. loop {@npcvar}:
  94. delete {ds.item.%loop-value%::*}
  95. delete {@npcvar}
  96. if arg 1 is not set:
  97. send " "
  98. send "{@pref}{@dscreate}"
  99. send "{@pref}{@dsdelete}"
  100. send "{@pref}{@dstype}"
  101. send "{@pref}{@dsadd}"
  102. send "{@pref}{@dsinfo}"
  103. send "{@pref}{@dslist}"
  104. send "{@pref}{@dsreload}"
  105. send " "
  106. send "%{_c1}%&m--------------------]%{_c2}% Deluxe Sell %{_c1}%&m[--------------------"
  107. if arg 1 is "reload":
  108. player command "/sk reload %script%"
  109. if arg 1 is "create":
  110. if arg 2 is not set:
  111. send "{@pref2} {@dserrname}"
  112. send " "
  113. send "{@pref2} {@dscreate}"
  114. stop
  115. if arg 3 is not set:
  116. send "{@pref2} {@dserrmsg}"
  117. send " "
  118. send "{@pref2} {@dscreate}"
  119. stop
  120. loop {@npcvar}:
  121. set {_a::*} to loop-value split at ".|."
  122. if "%{_a::2}%" is "%arg 2%":
  123. send "{@pref2} {@dserrnameexs}"
  124. send "{@pref2} {@dserranother}"
  125. stop
  126. create a citizen named "%arg 2%" at player as a player
  127. set {_id} to last created citizen
  128. add "%{_id}%.|.%arg 2%.|.%arg 3%" to {@npcvar}
  129. send "{@pref2} {@dsnpccreated}"
  130. send "{@pref2} {@dsnpcmsg}"
  131. if arg 1 is "delete":
  132. if arg 2 is not set:
  133. send "{@pref2} {@dserrname}"
  134. send " "
  135. send "{@pref2} {@dsdelete}"
  136. stop
  137. loop {@npcvar}:
  138. set {_a::*} to loop-value split at ".|."
  139. if "%{_a::2}%" is "%arg 2%":
  140. player command "/npc sel %{_a::1}%"
  141. player command "/npc rem"
  142. remove loop-value from {@npcvar}
  143. send "{@pref2} {@dsnpcdeleted}"
  144. stop
  145. send "{@pref2} {@dsnpcnotfound}"
  146. if arg 1 is "type":
  147. if arg 2 is not set:
  148. send "{@pref2} {@dserrname}"
  149. send " "
  150. send "{@pref2} {@dsdelete}"
  151. stop
  152. loop {@npcvar}:
  153. set {_a::*} to loop-value split at ".|."
  154. if "%{_a::2}%" is "%arg 2%":
  155. player command "/npc sel %{_a::1}%"
  156. player command "/npc type %arg 3%"
  157. stop
  158. send "{@pref2} {@dsnpcnotfound}"
  159. if arg 1 is "list":
  160. if {@npcvar} is not set:
  161. send "{@pref2} {@dsnonpc}"
  162. send "{@pref2} {@dscreatepls}"
  163. send "{@pref2} {@dscreate}"
  164. stop
  165. send "{@dsnpclists}"
  166. send " "
  167. loop {@npcvar}:
  168. set {_n::*} to loop-value split at ".|."
  169. send "{@pref2} %{_c1}%%{_n::2}%"
  170. if arg 1 is "info":
  171. if {@npcvar} is not set:
  172. send "{@pref2} {@dsnonpc}"
  173. send "{@pref2} {@dscreatepls}"
  174. send "{@pref2} {@dscreate}"
  175. stop
  176. loop {@npcvar}:
  177. set {_a::*} to loop-value split at ".|."
  178. if "%{_a::2}%" is "%arg 2%":
  179. player command "/npc sel %{_a::1}%"
  180. player command "/npc tp"
  181. send "{@pref2} NPC NAME: %{_c5}%%{_a::2}%"
  182. send "{@pref2} NPC ID: %{_c5}%%{_a::1}%"
  183. if {@itemvar} is not set:
  184. send "{@pref2} {@dsnoitem}"
  185. stop
  186. send "{@pref2} {@dsitemlists}:"
  187. loop {@itemvar}:
  188. add 1 to {_item}
  189. set {_items::*} to {ds.item.%loop-value-1%::%{_item}%} split at ".|."
  190. if {_items::4} is set:
  191. send "{@pref2} %{_item}%. %{_c1}%%{_items::1}% %{_c2}%Price: %{_items::3}%$"
  192. if {_items::4} is not set:
  193. send "{@pref2} %{_item}%. %{_c1}%%{_items::1}% %{_c2}%Price: %{_items::2}%$"
  194. stop
  195. send "{@pref2} {@dsnpcnotfound}"
  196. if arg 1 is "add":
  197. if arg 2 is not set:
  198. send "{@pref2} {@dserrname}"
  199. send " "
  200. send "{@pref2} {@dsadd}"
  201. stop
  202. if arg 3 is not set:
  203. send "{@pref2} {@dserrprice}"
  204. send " "
  205. send "{@pref2} {@dsadd}"
  206. stop
  207. set {_oks} to "%player's tool%"
  208. set {_ok::*} to {_oks} split at " "
  209. set {_ok} to {_ok::1} parsed as number
  210. if {_ok} is set:
  211. send "{@pref2} {@dserronepiece}"
  212. stop
  213. set {_arg3} to "%arg 3%"
  214. set {_harga} to {_arg3} parsed as number
  215. if {_harga} is not set:
  216. send "{@pref2} Price Must Be Number"
  217. stop
  218. loop {@npcvar}:
  219. set {_a::*} to loop-value split at ".|."
  220. if "%{_a::2}%" is "%arg 2%":
  221. loop {@itemvar}:
  222. if "%name of player's tool%.|.%lore of player's tool%.|.%arg 3%.|.%type of player's tool%" is "%loop-value-2%":
  223. add 1 to {_false}
  224. if "%type of player's tool%.|.%lore of player's tool%.|.%arg 3%" is "%loop-value-2%":
  225. add 1 to {_false}
  226. if "%name of player's tool%.|.%arg 3%.|.%type of player's tool%" is "%loop-value-2%":
  227. add 1 to {_false}
  228. if "%type of player's tool%.|.%arg 3%" is "%loop-value-2%":
  229. add 1 to {_false}
  230. if {_false} is set:
  231. send "{@pref2} {@dserritemext}"
  232. stop
  233. set {_a::*} to loop-value split at ".|."
  234. if "%{_a::2}%" is "%arg 2%":
  235. if size of {@itemvar} is equal to 8:
  236. send "{@pref2} Maximum Sellable Item On this npc reached"
  237. stop
  238. if player is holding air:
  239. send "{@pref2} {@dserrair}"
  240. stop
  241. if name of player's tool is not set:
  242. if lore of player's tool is set:
  243. set {_nnhl} to true
  244. add "%type of player's tool%.|.%lore of player's tool%.|.%arg 3%" to {@itemvar}
  245. if lore of player's tool is not set:
  246. set {_nnnl} to true
  247. add "%type of player's tool%.|.%arg 3%" to {@itemvar}
  248. if name of player's tool is set:
  249. if lore of player's tool is set:
  250. set {_hnhl} to true
  251. add "%name of player's tool%.|.%lore of player's tool%.|.%arg 3%.|.%type of player's tool%" to {@itemvar}
  252. if lore of player's tool is not set:
  253. set {_hnnl} to true
  254. add "%name of player's tool%.|.%arg 3%.|.%type of player's tool%" to {@itemvar}
  255. if {_hnnl} is true:
  256. send "{@pref2} Item Name: %{_c1}%%name of player's tool%"
  257. send "{@pref2} Now Can Be Sold On %{_c2}%%arg 2% %{_c3}%NPC"
  258. send "{@pref2} %{_c3}%With Price: %{_c4}%%arg 3%"
  259. if {_nnnl} is true:
  260. send "{@pref2} Item Name: %{_c1}%%type of player's tool%"
  261. send "{@pref2} Now Can Be Sold On %{_c2}%%arg 2% %{_c3}%NPC"
  262. send "{@pref2} %{_c3}%With Price: %{_c4}%%arg 3%"
  263. if {_nnhl} is true:
  264. set {_lore::*} to lore of player's tool split at "||"
  265. send "{@pref2} Item Name: %{_c1}%%type of player's tool%"
  266. loop size of {_lore::*} times:
  267. send "{@pref2} Lore Line %loop-num%: %{_lore::%loop-num%}%"
  268. send "{@pref2} Now Can Be Sold On %{_c2}%%arg 2% %{_c3}%NPC"
  269. send "{@pref2} %{_c3}%With Price: %{_c4}%%arg 3%"
  270. if {_hnhl} is true:
  271. set {_lore::*} to lore of player's tool split at "||"
  272. send "{@pref2} Item Name: %{_c1}%%name of player's tool%"
  273. loop size of {_lore::*} times:
  274. send "{@pref2} Lore Line %loop-num%: %{_lore::%loop-num%}%"
  275. send "{@pref2} Now Can Be Sold On %{_c2}%%arg 2% %{_c3}%NPC"
  276. send "{@pref2} %{_c3}%With Price: %{_c4}%%arg 3%"
  277. stop
  278. send "{@pref2} {@dsnpcnotfound}"
  279. stop
  280. on citizen right click:
  281. wait 1 tick
  282. if player is online:
  283. add "a" to {_list::*}
  284. add "b" to {_list::*}
  285. add "c" to {_list::*}
  286. add "6" to {_list::*}
  287. add "d" to {_list::*}
  288. add "f" to {_list::*}
  289. add "7" to {_list::*}
  290. add "e" to {_list::*}
  291. loop 5 times:
  292. set {_c%loop-num%} to "&%a random element out of {_list::*}%"
  293. set {_c%loop-num%} to colored {_c%loop-num%}
  294. loop {@npcvar}:
  295. set {_id} to event-number
  296. set {_a::*} to loop-value split at ".|."
  297. add 1 to {_numbers}
  298. if "%{_a::1}%" is "87":
  299. set {ds.npc::%{_numbers}%} to "89.|.%{_a::2}%.|.%{_a::3}%"
  300. set {ds.item.%{ds.npc::%{_numbers}%}%::*} to {ds.item.87.|.%{_a::2}%.|.%{_a::3}%::*}
  301. if "%{_a::1}%" is "88":
  302. set {ds.npc::%{_numbers}%} to "90.|.%{_a::2}%.|.%{_a::3}%"
  303. set {ds.item.%{ds.npc::%{_numbers}%}%::*} to {ds.item.88.|.%{_a::2}%.|.%{_a::3}%::*}
  304. if "%{_a::1}%" is "%{_id}%":
  305. if inventory name of player's current inventory is "%{_a::2}% : %colored {_a::3}%":
  306. stop
  307. open chest with 3 row named "%{_a::2}% : %colored {_a::3}%" to player
  308. wait 4 tick
  309. loop 27 times:
  310. set {_slots} to loop-num - 1
  311. if {_slots} is not 13 or 22:
  312. format slot {_slots} of player with red stained glass pane named " " to be unstealable
  313. loop 8 times:
  314. set {_slots} to loop-num
  315. if player is online:
  316. format slot {_slots} of player with black stained glass pane named " " to be unstealable
  317. format slot 0 of player with shiny arrow named "&e&lList Items &7-&8>" with lore "&eSellable item In This NPC" to be unstealable
  318. format slot 22 of player with lime wool named "&aClick For Confirm" with lore "&e>> &fFill The Slot Then Click THIS &e<<" to run [invoke "sell" from player]
  319. loop {ds.item.%loop-value%::*}:
  320. add 1 to {_slot}
  321. set {_aaa} to {ds.item.%loop-value-1%::%{_slot}%}
  322. set {_item::*} to {_aaa} split at ".|."
  323. if {_item::4} is set:
  324. set {_item::4} to {_item::4} parsed as item
  325. if {_item::2} is set:
  326. format slot {_slot} of player with {_item::4} named "%{_item::1}%" with lore "%{_c4}%Sell Price: %{_c5}%%{_item::3}%||||%{_item::2}%" to be unstealable
  327. if {_item::2} is not set:
  328. format slot {_slot} of player with {_item::4} named "%{_item::1}%" with lore "%{_c4}%Sell Price: %{_c5}%%{_item::3}%" to be unstealable
  329. if {_item::4} is not set:
  330. set {_item::1} to {_item::1} parsed as item
  331. if {_item::3} is set:
  332. format slot {_slot} of player with {_item::1} named "%{_item::1}%" with lore "%{_c4}%Sell Price: %{_c5}%%{_item::3}%" to be unstealable
  333. if {_item::2} is not set:
  334. format slot {_slot} of player with {_item::1} named "%{_item::1}%" with lore "%{_c4}%Sell Price: %{_c5}%%{_item::3}%" to be unstealable
  335. sub "sell":
  336. if parameter 1 is online:
  337. add "a" to {_list::*}
  338. add "b" to {_list::*}
  339. add "c" to {_list::*}
  340. add "6" to {_list::*}
  341. add "d" to {_list::*}
  342. add "f" to {_list::*}
  343. add "7" to {_list::*}
  344. add "e" to {_list::*}
  345. loop 5 times:
  346. set {_c%loop-num%} to "&%a random element out of {_list::*}%"
  347. set {_c%loop-num%} to colored {_c%loop-num%}
  348. if inventory name of parameter 1's current inventory contains " : ":
  349. set {_sell} to parameter 1's current inventory's slot 13
  350. if parameter 1's current inventory's slot 13 is air:
  351. send "{@pref2} Put Item In The Blank Space" to parameter 1
  352. stop
  353. set {_item1} to parameter 1's current inventory's slot 1
  354. set {_item2} to parameter 1's current inventory's slot 2
  355. set {_item3} to parameter 1's current inventory's slot 3
  356. set {_item4} to parameter 1's current inventory's slot 4
  357. set {_item5} to parameter 1's current inventory's slot 5
  358. set {_item6} to parameter 1's current inventory's slot 6
  359. set {_item7} to parameter 1's current inventory's slot 7
  360. set {_item8} to parameter 1's current inventory's slot 8
  361. loop 8 times:
  362. set {_typesell} to type of parameter 1's current inventory's slot 13
  363. set {_typeitem} to type of parameter 1's current inventory's slot loop-num
  364. if "%{_typeitem}%" is "%{_typesell}%":
  365. if name of {_sell} is not set:
  366. set {_name} to "%type of parameter 1's current inventory's slot 13%"
  367. if name of {_sell} is set:
  368. set {_name} to "%name of parameter 1's current inventory's slot 13%"
  369. set {_a} to {_name}
  370. if "%name of {_item%loop-num%}%" is "%{_name}%":
  371. set {_lores::*} to lore of {_item%loop-num%} split at "||"
  372. if {_lores::3} is set:
  373. set {_b::*} to lore of {_sell} split at "||"
  374. set {_size} to size of {_lores::*} - 2
  375. loop {_size} times:
  376. set {_banyak} to loop-num-2 + 2
  377. add "%{_lores::%{_banyak}%}%" to {_real::*}
  378. set {_sizes} to size of {_real::*}
  379. loop {_sizes} times:
  380. if "%{_real::%loop-num-2%}%" is not "%{_b::%loop-num-2%}%":
  381. send "{@pref2} You Cannot Sell This Item Here" to parameter 1
  382. stop
  383. set {_item} to "%{_sell}%"
  384. set {_amount::*} to {_item} split at " "
  385. set {_amount} to {_amount::1} parsed as number
  386. set {_lores::*} to lore of {_item%loop-num%} split at "||"
  387. set {_lore::*} to {_lores::1} split at " "
  388. set {_1} to "%uncolored {_lore::3}%"
  389. set {_2} to {_1} parsed as number
  390. if {_amount} is not set:
  391. set {_price} to {_2}
  392. send "{@pref2} &3You Sell &f%{_name}% &3With Price &6%{_price}%&a$" to parameter 1
  393. add {_price} to parameter 1's balance
  394. remove {_sell} from parameter 1's current inventory
  395. stop
  396. wait 2 tick
  397. set {_price} to {_2} * {_amount}
  398. add {_price} to parameter 1's balance
  399. send "{@pref2} &3You Sell &c%{_amount}% &f%{_name}% &3With Price &6%{_price}%&a$" to parameter 1
  400. remove {_sell} from parameter 1's current inventory
  401. stop
  402. send "{@pref2} You Cannot Sell This Item Here" to parameter 1
  403. stop
  404. on inventory close:
  405. if inventory name of player's current inventory contains " : ":
  406. set {_b} to player's current inventory's slot 13
  407. give player {_b}
  408. loop items in player's inventory:
  409. if name of loop-item is " ":
  410. remove loop-item from player
  411. if lore of loop-item contains "Sell Price":
  412. remove loop-item from player
  413. if name of loop-item contains "List Items":
  414. remove loop-item from player
  415. if name of loop-item contains "Confirm":
  416. remove loop-item from player
Advertisement
Add Comment
Please, Sign In to add comment