Advertisement
Combreal

ltd2.lua

Apr 15th, 2014
606
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.07 KB | None | 0 0
  1. -- Server messages and CTF OnPlayerScore function --
  2.  
  3. scores = {}
  4. welcome_message_table = {}
  5. persistant_message_table = {}
  6. welcome_message_table[1] = "WELCOME.. DID YOU KNOW GAMESPY IS CLOSING ON MAY 31?"
  7. welcome_message_table[2] = "BUT DON'T WORRY.. HALO ISN'T FINISHING"
  8. welcome_message_table[3] = "YOU CAN STILL USE DIRECT IP TO JOIN OUR SERVERS"
  9. welcome_message_table[4] = "NOTE DOWN THIS IP: 185.16.85.100:2301"
  10. welcome_message_table[5] = "TYPE ip IN CHAT TO DISPLAY THE SERVER ADRESS AGAIN"
  11. welcome_message_table[8] = "FOR MORE INFO VISIT: WWW.LTD2CLAN.NET"
  12. welcome_message_table[9] = "ENTER YOUR TEXT HERE"
  13. persistant_message_table[1] = "GAMESPY IS CLOSING DOWN ON MAY 31"
  14. persistant_message_table[2] = "BUT DON'T WORRY.. HALO ISN'T FINISHING"
  15. persistant_message_table[3] = "YOU CAN STILL USE DIRECT IP TO JOIN OUR SERVERS"
  16. persistant_message_table[4] = "NOTE DOWN THIS IP: 185.16.85.100:2301"
  17. persistant_message_table[5] = "TYPE ip IN CHAT TO DISPLAY THE SERVER ADRESS AGAIN"
  18. persistant_message_table[8] = "FOR MORE INFO VISIT: WWW.LTD2CLAN.NET"
  19. persistant_message_table[9] = "ENTER YOUR TEXT HERE"
  20.  
  21. function GetRequiredVersion() return 200 end
  22.  
  23. function OnScriptLoad(processId, game, persistent)
  24.     gametype_game = readbyte(0x671340 + 0x30)
  25.     team_play = readbyte(0x671340 + 0x34)
  26.     messageTimer = registertimer(3*60000, "AutoMessage")
  27. end
  28.  
  29. function OnGameEnd(stage)
  30.     removetimer(messageTimer)
  31. end
  32.  
  33. function AutoMessage(id, count)
  34.     for i = 1, #persistant_message_table do
  35.         if persistant_message_table[i] ~= "ENTER YOUR TEXT HERE" and persistant_message_table[i] ~= "" and persistant_message_table[i] ~= nil then
  36.             say(persistant_message_table[i])
  37.         end
  38.     end
  39.     return true
  40. end
  41.  
  42. function OnPlayerJoin(player)
  43.     scores[gethash(player)] = 0
  44.     for i = 1, #welcome_message_table do
  45.         if welcome_message_table[i] ~= "ENTER YOUR TEXT HERE" and welcome_message_table[i] ~= "" and welcome_message_table[i] ~= nil then
  46.             privatesay(player, welcome_message_table[i])
  47.         end
  48.     end
  49. end
  50.  
  51. function OnServerChat(player, type, message)
  52.     local response = nil
  53.     if player then
  54.         if string.lower(message) == "ip" then
  55.             local response = false
  56.             privatesay(player, "185.16.85.100:2301")
  57.             return response
  58.         end
  59.     end
  60.     return response
  61. end
  62.  
  63. function OnTeamChange(player, old_team, new_team, relevant)
  64.     scores[gethash(player)] = 0
  65. end
  66.  
  67. function OnPlayerScore(player, score, gametype)
  68.     local name = getname(player)
  69.     local team = getteam(player)
  70.     privatesay(player, "Welldone !")
  71.     if team == 1 then
  72.         say(name .. " just scored, good job blue team")
  73.     else
  74.         say(name .. " just scored, good job red team")
  75.     end
  76. end
  77.  
  78.  
  79. function OnClientUpdate(player)
  80.     if gethash(player) then
  81.         local score = getscore(player)
  82.         if score > scores[gethash(player)] then
  83.             OnPlayerScore(player, score, gametype_game)
  84.             scores[gethash(player)] = score
  85.         end
  86.     end
  87. end
  88.  
  89. function getscore(player)
  90.     local score = 0
  91.     local timed = false
  92.     if gametype_game == 1 then
  93.         score = readword(getplayer(player) + 0xC8)
  94.     end
  95.     if timed == true then
  96.         score = math.floor(score / 30)
  97.     end
  98.     return score
  99. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement