Advertisement
Combreal

ltd2Message.lua

May 5th, 2014
774
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.52 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] = "<LTD2CLAN.NET> WELCOME ON LTD2 ROCKETGULCH CTF !"
  7. welcome_message_table[2] = "<LTD2CLAN.NET> GAMESPY IS CLOSING SOON - PLEASE USE DIRECT IP TO JOIN OUR SERVERS"
  8. welcome_message_table[3] = "<LTD2CLAN.NET> 1 - TYPE ip IN SERVER CHAT TO SEE THIS SERVER ADRESS"
  9. welcome_message_table[4] = "<LTD2CLAN.NET> 2 - PRESS F1 TO SEE THE SERVER'S IP AND THEN WRITE IT DOWN"
  10. welcome_message_table[5] = "<LTD2CLAN.NET> 3 - USE GAMETRACKER TO CHECK FOR HALO SERVER LISTS AND IP'S"
  11. welcome_message_table[8] = "<LTD2CLAN.NET> FOR A FULL LIST OF OUR SERVER'S IP VISIT : WWW.LTD2CLAN.NET/SERVERS"
  12. welcome_message_table[9] = "ENTER YOUR TEXT HERE"
  13. persistant_message_table[1] = "<LTD2CLAN.NET> WELCOME ON LTD2 ROCKETGULCH CTF !"
  14. persistant_message_table[2] = "<LTD2CLAN.NET> GAMESPY IS CLOSING SOON - PLEASE USE DIRECT IP TO JOIN OUR SERVERS"
  15. persistant_message_table[3] = "<LTD2CLAN.NET> 1 - TYPE ip IN SERVER CHAT TO SEE THIS SERVER ADRESS"
  16. persistant_message_table[4] = "<LTD2CLAN.NET> 2 - PRESS F1 TO SEE THE SERVER'S IP AND THEN WRITE IT DOWN"
  17. persistant_message_table[5] = "<LTD2CLAN.NET> 3 - USE GAMETRACKER TO CHECK FOR HALO SERVER LISTS AND IP'S"
  18. persistant_message_table[8] = "<LTD2CLAN.NET> FOR A FULL LIST OF OUR SERVER'S IP VISIT : WWW.LTD2CLAN.NET/SERVERS"
  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], false)
  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], false)
  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, "<LTD2CLAN.NET> 185.16.85.100:2301", false)
  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, "<LTD2CLAN.NET> Welldone !", false)
  71.     if team == 1 then
  72.         say("<LTD2CLAN.NET> " .. name .. " just scored, good job blue team", false)
  73.     else
  74.         say("<LTD2CLAN.NET> " .. name .. " just scored, good job red team", false)
  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