-- Slow down peeps holding the flag --
scores = {}
holding = {}
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
holding[gethash(player)] = 0
end
function OnTeamChange(player, old_team, new_team, relevant)
scores[gethash(player)] = 0
holding[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
if isHoldingFlag(player) then
setspeed(player, 0.7)
else
setspeed(player, 1)
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
function isHoldingFlag(player)
local redflag = readdword(0x639B98 + 0x0)
local blueflag = readdword(0x639B98 + 0x4)
local m_object = getobject(getplayerobjectid(player))
for i = 0,3 do
local weapId = readdword(m_object + 0x2F8 + i*4)
if weapId == redflag or weapId == blueflag then
return true
end
end
return false
end
Comments
0 B
|👍
/👎