Pedrook
Advanced OT User
- Joined
- May 24, 2009
- Messages
- 484
- Solutions
- 3
- Reaction score
- 224
- Location
- Brazil
- GitHub
- pedrogiampietro
I have a script that a member here helped me in the request, now I would like to add bufs to the ranks, for example rank 1 add 5 skill, or hp, can anyone help:
local config = {
interval = 5,
ranks = {
{minBalance = 10000, rankName = "Knight", effect = CONST_ME_FIREWORK_RED},
{minBalance = 10000, rankName = "Duke", effect = CONST_ME_FIREWORK_RED},
{minBalance = 100000, rankName = "King", effect = CONST_ME_FIREWORK_RED},
},
}
local function getRankByBalance(balance)
for i = 1, #config.ranks do
if balance < config.ranks.minBalance then
return (i - 1 > 0) and (i - 1) or false
end
end
return false
end
local function sendEffectTopPlayer(cid, rank)
local player = Player(cid)
if not player then
return true
end
player:getPosition():sendMagicEffect(config.ranks[rank].effect)
player:say(config.ranks[rank].rankName, TALKTYPE_MONSTER_SAY)
addEvent(sendEffectTopPlayer, config.interval * 1000, cid, rank)
return true
end
function onLogin(player)
local rank = getRankByBalance(player:getBankBalance())
if rank then
sendEffectTopPlayer(player:getId(), rank)
end
return true
end
interval = 5,
ranks = {
{minBalance = 10000, rankName = "Knight", effect = CONST_ME_FIREWORK_RED},
{minBalance = 10000, rankName = "Duke", effect = CONST_ME_FIREWORK_RED},
{minBalance = 100000, rankName = "King", effect = CONST_ME_FIREWORK_RED},
},
}
local function getRankByBalance(balance)
for i = 1, #config.ranks do
if balance < config.ranks.minBalance then
return (i - 1 > 0) and (i - 1) or false
end
end
return false
end
local function sendEffectTopPlayer(cid, rank)
local player = Player(cid)
if not player then
return true
end
player:getPosition():sendMagicEffect(config.ranks[rank].effect)
player:say(config.ranks[rank].rankName, TALKTYPE_MONSTER_SAY)
addEvent(sendEffectTopPlayer, config.interval * 1000, cid, rank)
return true
end
function onLogin(player)
local rank = getRankByBalance(player:getBankBalance())
if rank then
sendEffectTopPlayer(player:getId(), rank)
end
return true
end
Last edited: