Rawoas13

Untitled

May 26th, 2020
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. local rainbowNames = {}
  2. local nameColors = {"EB0C0C","EB790C","EBE70C","0DEB0C","0CC2EB","214AED","B221ED"}
  3.  
  4. system.disableChatCommandDisplay("rainbow", true)
  5.  
  6. function eventLoop()
  7.   if #rainbowNames >= 1 then
  8.     for i,v in next, rainbowNames do
  9.       tfm.exec.setNameColor(v,"0x"..nameColors[math.random(#nameColors)])
  10.     end
  11.   end
  12. end
  13.  
  14. function string.split(s, pattern, n)
  15.   local st = {}
  16.   for sb in string.gmatch(s, "[^"..pattern.."]+") do
  17.     if not n or n > -1 then
  18.       table.insert(st,sb)
  19.     else
  20.       st[#st] = st[#st]..pattern..sb
  21.     end
  22.     n = n and n-1 or false
  23.   end
  24.   return st
  25. end
  26.  
  27. function eventChatCommand(playerExecuted, command)
  28.   args = string.split(command, " ")
  29.   if string.upper(args[1]) == "RAINBOW" then
  30.     if args[2] and string.upper(args[2]) == "ON" then
  31.       if args[3] and tostring(args[3]):sub(-5,-5) == "#" then
  32.         table.insert(rainbowNames,args[3])
  33.       end
  34.     elseif args[2] and args[3] and string.upper(args[2]) == "OFF" then
  35.       for i, v in next, rainbowNames do
  36.         if v == args[3] then
  37.           rainbowNames[i] = nil
  38.           break
  39.         end
  40.       end
  41.     end
  42.   end
  43. end
Add Comment
Please, Sign In to add comment