LUA 247
V2+ Automatic Messages 1.1 By xdedeone on 26th February 2019 04:30:01 PM
  1. --[[ ###  Automatic Server Messages 1.1 ###]]--
  2. --[[ ###    by H® Shaft for Phasor v2+  ###]]--
  3.  
  4. -- Enable server admins to setup automatic server messages: single line messages that will be shown to players based on the delay frequency you set
  5. -- You can determine the order of the messages as sequential or random: default sequential (see random_order below)
  6. -- Default: 1 message shown per minute
  7.  
  8. -- messages table: add your own, ensure the messages are within quotes, and separated by a comma between each message
  9.  
  10. messages = {
  11. "Message 1",
  12. "Message 2",
  13. "Message 3",
  14. "Message 4",
  15. "Message 5",
  16. "Message 6",
  17. "Message 7",
  18. "Message 8",
  19. "Message 9",
  20. "Message 10"
  21. }
  22.  
  23. -- message order: random order if set to true, sequential (1,2,3,etc) if set to false
  24.  
  25. random_order = false
  26.  
  27. -- message shown when player joins, followed by player name! Example: Welcome to the best server H® Shaft!    
  28.        
  29. join_message = "Welcome message here"
  30.  
  31. -- message shown when game ends, followed by player name! Example: Thanks for playing in the best server H® Shaft!
  32.  
  33. end_message = "Thanks for playing [here]"
  34.  
  35. -- delay in minutes between each message, Default: 1 message shown per minute
  36.  
  37. message_delay = 1
  38.  
  39. function GetRequiredVersion()
  40.         return 200
  41. end
  42.  
  43. function OnScriptLoad(process, game, persistent)
  44.         message_no = 1
  45.         timedmessage = registertimer(message_delay * 60000, "TimedMessages")
  46. end
  47.  
  48. function OnPlayerJoin(player)
  49.         if getplayer(player) then
  50.                 privatesay(player, join_message .. " " .. getname(player) .. "! ")
  51.         end    
  52. end
  53.  
  54. function TimedMessages(id, count)
  55.         for i = 0,15 do
  56.                 if getplayer(i) then
  57.                         privatesay(i, messages[message_no])
  58.                         if not random_order then
  59.                                 message_no = message_no + 1
  60.                                 if message_no > #messages then
  61.                                         message_no = 1
  62.                                 end                            
  63.                         else
  64.                                 if #messages > 1 then
  65.                                         message_no = getrandomnumber(1, #messages)
  66.                                 end
  67.                         end                    
  68.                 end
  69.         end
  70.         return true
  71. end
  72.  
  73. function OnGameEnd(stage)
  74.         if stage == 1 then
  75.                 message_no = 1         
  76.         elseif stage == 2 then
  77.                 for i = 0,15 do
  78.                         if getplayer(i) then
  79.                                 privatesay(i, end_message " " .. getname(i) .. "!")
  80.                         end            
  81.                 end
  82.         end    
  83. end
  84.  
  85. -- Created by H® Shaft thank you to Oxide, AelitePrime, Nugget & Wizard.
  86. -- Visit http://halorace.org/forum/index.php?topic=514.0 or
  87. -- Visit http://pastebin.com/u/HR_Shaft for more phasor scripts

HaloNet.Net is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.