Nessiesson

rainbowhat

Aug 30th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #Rainbow Hat
  2. /rainbowhat [$player] = >>>
  3. if(_nisadmin(player()), die('Unknown command. Type "/help" for help.'))
  4. @player = player()
  5. if($player != '', @player = player($player))
  6. if(import('rainbowhat.'.@player) != null){
  7. clear_task(import('rainbowhat.'.@player))
  8. export('rainbowhat.'.@player, null)
  9. set_pinv(@player, array(103: null))
  10. die('No more rainbow hat :(')
  11. }
  12. msg('Rainbow hat!!!')
  13. set_pinv(@player, array(103: array(type: 298)))
  14. @currentColor = array(0)
  15. @colors = array(
  16. array(255, 0, 0), #red
  17. array(255, 128, 0), #orange
  18. array(255, 255, 0), #yellow
  19. array(0, 255, 0), #green
  20. array(0, 0, 255), #blue
  21. array(127, 0, 255), #indigo
  22. array(102, 0, 204) #violet
  23. )
  24. @interval = set_interval(200, closure(
  25. if(!ponline(@player) || pinv(@player, 103)['type'] != 298){
  26. clear_task()
  27. } else {
  28. @cindex = @currentColor[0]
  29. @currentColor[0] = if(@currentColor[0] >= array_size(@colors) - 1, 0, @currentColor[0] + 1)
  30. @color = @colors[@currentColor[0]]
  31. set_armor_color(@player, 103, @color)
  32. }
  33. ))
  34. export('rainbowhat.'.@player, @interval)
  35. <<<
Advertisement
Add Comment
Please, Sign In to add comment