Combreal icon

ltd2.lua

Combreal | PRO | 04/15/14 08:53:22 PM UTC | 0 ⭐ | 1146 👁️ | Never ⏰ | []
Lua |

3.07 KB

|

None

|

0 👍

/

0 👎

-- Server messages and CTF OnPlayerScore function --
 
scores = {}
welcome_message_table = {}
persistant_message_table = {}
welcome_message_table[1] = "WELCOME.. DID YOU KNOW GAMESPY IS CLOSING ON MAY 31?"
welcome_message_table[2] = "BUT DON'T WORRY.. HALO ISN'T FINISHING"
welcome_message_table[3] = "YOU CAN STILL USE DIRECT IP TO JOIN OUR SERVERS"
welcome_message_table[4] = "NOTE DOWN THIS IP: 185.16.85.100:2301"
welcome_message_table[5] = "TYPE ip IN CHAT TO DISPLAY THE SERVER ADRESS AGAIN"
welcome_message_table[8] = "FOR MORE INFO VISIT: WWW.LTD2CLAN.NET"
welcome_message_table[9] = "ENTER YOUR TEXT HERE"
persistant_message_table[1] = "GAMESPY IS CLOSING DOWN ON MAY 31"
persistant_message_table[2] = "BUT DON'T WORRY.. HALO ISN'T FINISHING"
persistant_message_table[3] = "YOU CAN STILL USE DIRECT IP TO JOIN OUR SERVERS"
persistant_message_table[4] = "NOTE DOWN THIS IP: 185.16.85.100:2301"
persistant_message_table[5] = "TYPE ip IN CHAT TO DISPLAY THE SERVER ADRESS AGAIN"
persistant_message_table[8] = "FOR MORE INFO VISIT: WWW.LTD2CLAN.NET"
persistant_message_table[9] = "ENTER YOUR TEXT HERE"
 
function GetRequiredVersion() return 200 end
 
function OnScriptLoad(processId, game, persistent)
    gametype_game = readbyte(0x671340 + 0x30)
    team_play = readbyte(0x671340 + 0x34)
    messageTimer = registertimer(3*60000, "AutoMessage")
end
 
function OnGameEnd(stage)
    removetimer(messageTimer)
end
 
function AutoMessage(id, count)
    for i = 1, #persistant_message_table do
        if persistant_message_table[i] ~= "ENTER YOUR TEXT HERE" and persistant_message_table[i] ~= "" and persistant_message_table[i] ~= nil then
            say(persistant_message_table[i])
        end
    end
    return true
end
 
function OnPlayerJoin(player)
    scores[gethash(player)] = 0
    for i = 1, #welcome_message_table do
        if welcome_message_table[i] ~= "ENTER YOUR TEXT HERE" and welcome_message_table[i] ~= "" and welcome_message_table[i] ~= nil then
            privatesay(player, welcome_message_table[i])
        end
    end
end
 
function OnServerChat(player, type, message)
    local response = nil
    if player then
        if string.lower(message) == "ip" then
            local response = false
            privatesay(player, "185.16.85.100:2301")
            return response
        end
    end
    return response
end
 
function OnTeamChange(player, old_team, new_team, relevant)
    scores[gethash(player)] = 0
end
 
function OnPlayerScore(player, score, gametype)
    local name = getname(player)
    local team = getteam(player)
    privatesay(player, "Welldone !")
    if team == 1 then
        say(name .. " just scored, good job blue team")
    else
        say(name .. " just scored, good job red team")
    end
end
 
 
function OnClientUpdate(player)
    if gethash(player) then
        local score = getscore(player)
        if score > scores[gethash(player)] then
            OnPlayerScore(player, score, gametype_game)
            scores[gethash(player)] = score
        end
    end
end
 
function getscore(player)
    local score = 0
    local timed = false
    if gametype_game == 1 then
        score = readword(getplayer(player) + 0xC8)
    end
    if timed == true then
        score = math.floor(score / 30)
    end
    return score
end

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎