Advertisement
Guest User

Untitled

a guest
Apr 21st, 2013
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.55 KB | None | 0 0
  1. #=========================================================================#
  2. #
  3. # Command Helper sample config file
  4. #
  5. #=========================================================================#
  6.  
  7. #lines that start with # are comments
  8.  
  9. #Give command, with material name lookup
  10. # Note that the second variable $qty is optional, and if no value
  11. # is given, 1 is the default. The function player() returns the
  12. # name of this player, and data_values() turns "stone" into 1
  13. # Also note that the command is labelled with "creative". If you
  14. # are running a creative server, and the users should always be able to give
  15. # themselves items, then they can do so with this command, without having to be
  16. # opped.
  17. creative:/i $data [$qty=1] = runas('~op', sconcat(/give player() data_values($data) $qty))
  18. ###
  19.  
  20. #Give the player a diamond pickaxe, shovel, and axe
  21. # Note that commands are separated by \ and this creates a macro
  22. /kit diamond = /give player() data_values('diamond_pickaxe') 1 \
  23. /give player() data_values('diamond_spade') 1 \
  24. /give player() data_values('diamond_axe') 1
  25. ###
  26.  
  27. #Give the player 64 each of gold tools
  28. # Note that the data_values function uses the enum values of
  29. # the material
  30. /kit gold = /give player() data_values('gold_pickaxe') 64 \
  31. /give player() data_values('gold_spade') 64 \
  32. /give player() data_values('gold_axe') 64
  33. ###
  34.  
  35. #Sets the time on the server, and uses english words to set the time
  36. #If the english word isn't "day" or "night", it uses the number
  37. # Note that the equals function returns a true value if the two
  38. # parameters are the same, and if() runs the second argument if the
  39. # first argument is true, and the third argument if it is false.
  40. # To make an "if else" statement, you can nest if() calls, as shown
  41. # here.
  42. /time $time = /time set if(equals($time, 'day'), 1, if(equals($time, 'night'), 13500, $time))
  43. ###
  44.  
  45. #Better tp. If "/tp name" is used, it implies "/tp thisplayer name"
  46. #but if "/tp name1 name2" is used, it implies "/tp name1 name2"
  47. /tp $p1 [$p2=''] = /tp if(equals($p2, ''), player(), $p1) if(equals($p2, ''), $p1, $p2)
  48. ###
  49.  
  50. #Simple alias for /tell
  51. # The special variable "$" must be the last variable, and it matches all
  52. # the arguments from that point on
  53. /msg $player $ = /tell $player $
  54. ###
  55.  
  56. #Simple alias for /save-all
  57. # Super simple aliases can be error proofed by matching all arguments, then
  58. # not using them. Note that this will result in a warning, but it will
  59. # compile fine.
  60. /save $ = /save-all
  61. ###
  62.  
  63. #Shows help information
  64. # This demonstrates how to use die() and msg(). They work basically the same, except
  65. # die() kills the command if evaluated. They both send a message to the player.
  66. /help [$cmd=''] = if(equals($cmd, ''), die('Do you need halp?'), if(equals($cmd, 'commandhelper'), msg('The best plugin ever!'), ''))
  67. ###
  68.  
  69. #Echoes information back to the user
  70. # This demonstrates how to do string concatenation
  71. /ping $ = die(concat('Pong!', ' ', $))
  72.  
  73. #Kills the player, optionally with a message. Demonstrates how to use the multiline construct.
  74. thor:/thor $player [$=''] = >>>
  75. lightning(ploc($player))
  76. msg('Thou hast smitten the evil player ', $player, ' with thy mighty hand')
  77. tmsg($player, color('red'), if(equals($, ''), 'You have been smitten by Thor\'s Hammer!', $))
  78. kill($player)
  79. <<<
  80.  
  81. #Suppose we have a plugin that broadcasts messages only to moderators, but it doesn't include the user's name
  82. #Also suppose that it is a very long command.
  83. #We can use this command to fix that:
  84. /heyo $ = /mod-broadcast concat('(',player(),')') $
  85.  
  86. #Lets notify our users to use the new, shorter version
  87. /mod-broadcast [$] = die(concat(color('red'), 'Use /mb instead of /mod-broadcast'))
  88.  
  89. #Creates a simple way to control the weather
  90. rain:/rain $true_false = storm($true_false)
  91.  
  92.  
  93. #Demonstrates the for function, as well as ivars
  94. #Lists all players on the server
  95. /list = >>>
  96. #Initialize an empty string
  97. assign(@pl, '')
  98. assign(@ap, all_players())
  99. #loop through the array stored in @ap, from 0 to one less than the size of the array
  100. for(assign(@i, 0), lt(@i, array_size(@ap)), assign(@i, add(@i, 1)),
  101. #append our player's name to the end of @pl string
  102. assign(@pl, concat(@pl, @ap[@i], ' '))
  103. )
  104. #output the string
  105. msg(@pl)
  106. <<<
  107. /takim = >>>
  108. msg('List of available commands:')
  109. msg('/takim kur - create a faction')
  110. msg('/takim ev - go to your faction home')
  111. <<<
  112. /f create = msg('§cYou should better use §e/takim kur§c.')
  113.  
  114. /ada = >>>
  115. msg('List of available commands:')
  116. msg('/ada yenile - restarts your island')
  117. <<<
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement