Worked fantastic, Can you add were only a god can say the commands?
local talk = TalkAction("/boost", "!boost")
function talk.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local booststorage = player:getStorageValue(SKILL_BOOST_CONF.storage)
if booststorage and (booststorage > os.time()) then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Your boost is still active.')
return false
end
player:setStorageValue(SKILL_BOOST_CONF.storage, os.time() + SKILL_BOOST_CONF.time)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Boost has...
SKILL_BOOST_CONF = {
storage = 11223,
-- 1 hour
time = 3600 * 1,
expRate = 1.2, -- +20%
magicRate = 1.2, -- +20%
skillRate = 1.2 -- +20%
}
local talk = TalkAction("/boost", "!boost")
function talk.onSay(player, words, param)
local booststorage = player:getStorageValue(SKILL_BOOST_CONF.storage)
if booststorage and (booststorage > os.time()) then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Your boost is still active.')
return false
end
player:setStorageValue(SKILL_BOOST_CONF.storage, os.time() + SKILL_BOOST_CONF.time)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Boost has been activated. It will remain active for ' .. timeToReadable(SKILL_BOOST_CONF.time))
return false
end
function timeToReadable(t)
local str = os.date('!%T', t)
str = string.split(str, ':')
return tonumber(str[1]) .. 'h ' .. tonumber(str[2]) .. 'm ' .. tonumber(str[3]) ..'s.'
end
talk:separator(" ")
talk:register()
Player:onGainSkillTries
add the following:-- Apply magic & skill boost
local booststorage = self:getStorageValue(SKILL_BOOST_CONF.storage)
if booststorage and (booststorage > os.time()) then
if skill == SKILL_MAGLEVEL then
tries = tries * SKILL_BOOST_CONF.magicRate
else
tries = tries * SKILL_BOOST_CONF.skillRate
end
end
if skill == SKILL_MAGLEVEL then
tries = tries * configManager.getNumber(configKeys.RATE_MAGIC)
return hasEventCallback(EVENT_CALLBACK_ONGAINSKILLTRIES) and EventCallback(EVENT_CALLBACK_ONGAINSKILLTRIES, self, skill, tries) or tries
end
tries = tries * configManager.getNumber(configKeys.RATE_SKILL)
Player:onGainExperience
add the following:-- apply exp boost
local booststorage = self:getStorageValue(SKILL_BOOST_CONF.storage)
if booststorage and (booststorage > os.time()) then
exp = exp * SKILL_BOOST_CONF.expRate
end
return hasEventCallback(EVENT_CALLBACK_ONGAINEXPERIENCE) and EventCallback(EVENT_CALLBACK_ONGAINEXPERIENCE, self, source, exp, rawExp) or exp
Worked fantastic, Can you add were only a god can say the commands?
local talk = TalkAction("/boost", "!boost")
function talk.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local booststorage = player:getStorageValue(SKILL_BOOST_CONF.storage)
if booststorage and (booststorage > os.time()) then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Your boost is still active.')
return false
end
player:setStorageValue(SKILL_BOOST_CONF.storage, os.time() + SKILL_BOOST_CONF.time)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Boost has been activated. It will remain active for ' .. timeToReadable(SKILL_BOOST_CONF.time))
return false
end
function timeToReadable(t)
local str = os.date('!%T', t)
str = string.split(str, ':')
return tonumber(str[1]) .. 'h ' .. tonumber(str[2]) .. 'm ' .. tonumber(str[3]) ..'s.'
end
talk:separator(" ")
talk:register()