SHARE
TWEET

/helm command for CommandHelper

oxguy3 Feb 7th, 2014 168 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Use currently held block as helmet (/helm)
  2. # Made by Hayden Schiff (oxguy3)
  3. all:/helm = >>>
  4.     assign(@helditem, pinv(player(), null))
  5.     if (@helditem != null && @helditem['type'] >= 256) {
  6.         msg(concat(color(red), 'Error: Only blocks are allowed as helmets'))
  7.     } else {
  8.         assign(@helmetitem, pinv(player(), 103))
  9.         set_pinv(array(103: @helditem, null: @helmetitem))
  10.         msg(concat(color(green), data_name(@helditem), ' moved to helmet slot!'))
  11.     }
  12. <<<
  13. admin:/helm $item = >>>
  14.     if (data_values($item) == null && $item != '0') {
  15.         msg(concat(color(red), 'Error: Unknown item name'))
  16.     } else if(data_values($item) >= 256) {
  17.         msg(concat(color(red), 'Error: Only blocks are allowed as helmets'))
  18.     } else {
  19.         assign(@helmetitem, pinv(player(), 103))
  20.         #if (@helmetitem != null) {
  21.         #    pgive_item(concat(@helmetitem['type'], ':', @helmetitem['data']), @helmetitem['qty'])
  22.         #}
  23.         set_pinv(array(103: array(type: data_values($item), qty:1)))
  24.         msg(concat(color(green), 'Helmet set to ', data_name(data_values($item)), '!'))
  25.     }
  26. <<<
  27. admin:/helm $item $player = >>>
  28.     try (
  29.         player($player),
  30.         @ex,
  31.         die(concat(color(red), 'Error: Player not found')),
  32.         PlayerOfflineException
  33.     )
  34.     if (data_values($item) == null && $item != '0') {
  35.         msg(concat(color(red), 'Error: Unknown item name'))
  36.     } else if(data_values($item) >= 256) {
  37.         msg(concat(color(red), 'Error: Only blocks are allowed as helmets'))
  38.     } else {
  39.         assign(@helmetitem, pinv($player, 103))
  40.         #if (@helmetitem != null) {
  41.         #    pgive_item($player, concat(@helmetitem['type'], ':', @helmetitem['data']), @helmetitem['qty'])
  42.         #}
  43.         set_pinv($player, array(103: array(type: data_values($item), qty:1)))
  44.         msg(concat(color(green), player($player), '\'s helmet set to ', data_name(data_values($item)), '!'))
  45.     }
  46. <<<
  47. admin:/helm $item $player $ = msg(color(red) 'Usage: /helm [item] [player]')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top