Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=========================================================================#
- #
- # Command Helper sample config file
- #
- #=========================================================================#
- #lines that start with # are comments
- #Give command, with material name lookup
- # Note that the second variable $qty is optional, and if no value
- # is given, 1 is the default. The function player() returns the
- # name of this player, and data_values() turns "stone" into 1
- # Also note that the command is labelled with "creative". If you
- # are running a creative server, and the users should always be able to give
- # themselves items, then they can do so with this command, without having to be
- # opped.
- creative:/i $data [$qty=1] = runas('~op', sconcat(/give player() data_values($data) $qty))
- ###
- #Give the player a diamond pickaxe, shovel, and axe
- # Note that commands are separated by \ and this creates a macro
- /kit diamond = /give player() data_values('diamond_pickaxe') 1 \
- /give player() data_values('diamond_spade') 1 \
- /give player() data_values('diamond_axe') 1
- ###
- #Give the player 64 each of gold tools
- # Note that the data_values function uses the enum values of
- # the material
- /kit gold = /give player() data_values('gold_pickaxe') 64 \
- /give player() data_values('gold_spade') 64 \
- /give player() data_values('gold_axe') 64
- ###
- #Sets the time on the server, and uses english words to set the time
- #If the english word isn't "day" or "night", it uses the number
- # Note that the equals function returns a true value if the two
- # parameters are the same, and if() runs the second argument if the
- # first argument is true, and the third argument if it is false.
- # To make an "if else" statement, you can nest if() calls, as shown
- # here.
- /time $time = /time set if(equals($time, 'day'), 1, if(equals($time, 'night'), 13500, $time))
- ###
- #Better tp. If "/tp name" is used, it implies "/tp thisplayer name"
- #but if "/tp name1 name2" is used, it implies "/tp name1 name2"
- /tp $p1 [$p2=''] = /tp if(equals($p2, ''), player(), $p1) if(equals($p2, ''), $p1, $p2)
- ###
- #Simple alias for /tell
- # The special variable "$" must be the last variable, and it matches all
- # the arguments from that point on
- /msg $player $ = /tell $player $
- ###
- #Simple alias for /save-all
- # Super simple aliases can be error proofed by matching all arguments, then
- # not using them. Note that this will result in a warning, but it will
- # compile fine.
- /save $ = /save-all
- ###
- #Shows help information
- # This demonstrates how to use die() and msg(). They work basically the same, except
- # die() kills the command if evaluated. They both send a message to the player.
- /help [$cmd=''] = if(equals($cmd, ''), die('Do you need halp?'), if(equals($cmd, 'commandhelper'), msg('The best plugin ever!'), ''))
- ###
- #Echoes information back to the user
- # This demonstrates how to do string concatenation
- /ping $ = die(concat('Pong!', ' ', $))
- #Kills the player, optionally with a message. Demonstrates how to use the multiline construct.
- thor:/thor $player [$=''] = >>>
- lightning(ploc($player))
- msg('Thou hast smitten the evil player ', $player, ' with thy mighty hand')
- tmsg($player, color('red'), if(equals($, ''), 'You have been smitten by Thor\'s Hammer!', $))
- kill($player)
- <<<
- #Suppose we have a plugin that broadcasts messages only to moderators, but it doesn't include the user's name
- #Also suppose that it is a very long command.
- #We can use this command to fix that:
- /heyo $ = /mod-broadcast concat('(',player(),')') $
- #Lets notify our users to use the new, shorter version
- /mod-broadcast [$] = die(concat(color('red'), 'Use /mb instead of /mod-broadcast'))
- #Creates a simple way to control the weather
- rain:/rain $true_false = storm($true_false)
- #Demonstrates the for function, as well as ivars
- #Lists all players on the server
- /list = >>>
- #Initialize an empty string
- assign(@pl, '')
- assign(@ap, all_players())
- #loop through the array stored in @ap, from 0 to one less than the size of the array
- for(assign(@i, 0), lt(@i, array_size(@ap)), assign(@i, add(@i, 1)),
- #append our player's name to the end of @pl string
- assign(@pl, concat(@pl, @ap[@i], ' '))
- )
- #output the string
- msg(@pl)
- <<<
- /takim = >>>
- msg('List of available commands:')
- msg('/takim kur - create a faction')
- msg('/takim ev - go to your faction home')
- <<<
- /f create = msg('§cYou should better use §e/takim kur§c.')
- /ada = >>>
- msg('List of available commands:')
- msg('/ada yenile - restarts your island')
- <<<
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement