-- CTF OnPlayerScore function, inspired from Kennan work --
scores = {}
function GetRequiredVersion() return 200 end
function OnScriptLoad(processId, game, persistent)
gametype_game = readbyte(0x671340 + 0x30)
team_play = readbyte(0x671340 + 0x34)
end
function OnPlayerJoin(player)
scores[gethash(player)] = 0
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
0 B
|👍
/👎