vexler222
Active Member
- Joined
- Apr 22, 2012
- Messages
- 714
- Solutions
- 15
- Reaction score
- 46
Hi, i try get value from database cuz i have problem with loading globalevents before lib nvm, but i don't know how, im trying but everytime i got many errors
Code:
function onThink(creature, interval)
local xpp = db.storeQuery("SELECT 'exp' FROM 'boost_creature'")
local lott = db.storeQuery("SELECT 'loot' FROM 'boost_creature'")
local xpp2 = result.getDataString(xpp, 'exp')
local lott2 = result.getDataString(lott, 'loot')
local effects = {
{position = Position(1007, 994, 7), text = 'Exp +'.. xpp2 ..'%', effect = CONST_ME_BATS, textcolor = 140},
{position = Position(1009, 994, 7), text = 'Loot +'.. lott2 ..'%', effect = CONST_ME_BATS, textcolor = 140},
{position = Position(1008, 993, 7), text = 'BOOSTED', effect = CONST_ME_BATS, textcolor = 140},
}
for i = 1, #effects do
local settings = effects[i]
local spectators = Game.getSpectators(settings.position, false, true, 7, 7, 5, 5)
if #spectators > 0 then
if settings.text then
Game.sendAnimatedText(settings.text, settings.position, settings.textcolor)
end
if settings.effect then
settings.position:sendMagicEffect(settings.effect)
end
if settings.effect2 then
settings.position:sendMagicEffect(settings.effect2)
end
end
end
return true
end