Count1 = Game.SyncValue:Create ('Count1')
Count2 = Game.SyncValue:Create ('Count2')
Count3 = Game.SyncValue:Create ('Count3')
Count1_name = Game.SyncValue:Create ('Count1_name')
Count2_name = Game.SyncValue:Create ('Count2_name')
Count3_name = Game.SyncValue:Create('Count3_name')
Count1_name.value = tostring("--")
Count2_name.value = tostring("--")
Count3_name.value = tostring("--")
Count1.value = 0
Count2.value = 0
Count3.value = 0
function Game.Rule:OnKilled(victim, killer) -- 사망 시 발동하는 이벤트 함수(실질적인 랭킹 스크립트)
if killer ~= nil and killer ~= victim == true then
if victim:IsPlayer() == true and killer:IsPlayer() == true then
Man = Game.Player:Create(killer.index)
if killer.user.point > Count1.value then
if Count1_name.value ~= Man.name then
if Count2_name.value ~= Man.name then
Count3.value = Count2.value
Count3_name.value = Count2_name.value
Count2.value = Count1.value
Count2_name.value = Count1_name.value
else
Count2.value = Count1.value
Count2_name.value = Count1_name.value
end
end
Count1.value = tonumber(Man.user.point)
Count1_name.value = Man.name
elseif killer.user.point > Count2.value and Count1_name.value ~= Man.name then
if Count2_name.value ~= Man.name then
Count3.value = Count2.value
Count3_name.value = Count2_name.value
end
Count2.value = tonumber(Man.user.point)
Count2_name.value = Man.name
elseif killer.user.point > Count3.value and Count1_name.value ~= Man.name and Count2_name.value ~= Man.name then
Count3.value = tonumber(Man.user.point)
Count3_name.value = Man.name
end
end
end
end
function Game.Rule:OnPlayerConnect(player) -- 접속 시 0포인트 지급
player.user.point = 0
PointCheck()
end
function Game.Rule:OnPlayerDisconnect(player) -- 퇴장 시 포인트 제거
player.user.point = nil
PointCheck()
end
function PointCheck() -- 포인트 저장하는 테이블
if Players == nil then Players = {} end
for i=1, 32 do
Players.i = Game.Player:Create (i)
if Players.i == nil then return end
end
end