Advertisement
Guest User

Script For Fun

a guest
May 13th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. local function chatCommand(oPlayer, sText, bTeam)
  2.  
  3. local tText = string.Explode(' ', string.lower(sText))
  4.  
  5. // Not a command, let it through
  6. if string.Left(tText[1], 1) != '!' then return sText end
  7.  
  8. // Remove the ! infront of the first word
  9. local sCmd = string.sub(tText[1], 2)
  10.  
  11.  
  12. if sCmd == 'help' then
  13.  
  14. local tChat = {}
  15.  
  16. // This is how you would add colors
  17. //table.insert(tChat, Color(255, 255, 255))
  18. table.insert(tChat, 'Avaiable commands: !help, !love, !ping, !admin, !who')
  19.  
  20. chat.AddText(tChat)
  21.  
  22. // Suppress the chat message
  23. return ''
  24.  
  25. end
  26.  
  27. if sCmd == 'ping' then
  28.  
  29. local tChat = {}
  30.  
  31. //table.insert(tChat, Color(255, 255, 255))
  32. table.insert(tChat, 'Pong!')
  33.  
  34. chat.AddText(tChat)
  35.  
  36. return ''
  37.  
  38. end
  39.  
  40. if sCmd == 'admin' then
  41.  
  42. local tChat = {}
  43.  
  44. //table.insert(tChat, Color(255, 255, 255))
  45. table.insert(tChat, 'Any administrator is on their way.')
  46.  
  47. chat.AddText(tChat)
  48.  
  49. return ''
  50.  
  51. end
  52.  
  53. if sCmd == 'who' then
  54.  
  55. local tChat = {}
  56.  
  57. //table.insert(tChat, Color(255, 255, 255))
  58. table.insert(tChat, 'Please check console for a list of players.')
  59.  
  60. chat.AddText(tChat)
  61.  
  62. for iKey, oPlayer in ipairs(player.GetHumans()) do
  63.  
  64. print(oPlayer)
  65.  
  66. end
  67.  
  68. return ''
  69.  
  70. end
  71.  
  72. if sCmd == 'love' then
  73.  
  74. local tChat = {}
  75.  
  76. //table.insert(tChat, Color(255, 255, 255))
  77. table.insert(tChat, 'I Love You KEVIN!')
  78.  
  79. chat.AddText(tChat)
  80.  
  81. return ''
  82.  
  83. end
  84.  
  85. // You can add more commands by mimicing the if blocks above
  86.  
  87. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement