function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
if player:getStorageValue(1234) >= os.time() then
return true
end
player:setStorageValue(1234, os.time() + 86400)
Item(item.uid):remove(1)
return true
end
function Player:onGainExperience(source, exp, rawExp)
if self:getStorageValue(1234) >= os.time() then
exp = exp * 2
end
return exp
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
if player:getStorageValue(1234) >= os.time() then
return true
end
player:setStorageValue(1234, os.time() + 86400)
Item(item.uid):remove(1)
return true
end
function Player:onGainExperience(source, exp, rawExp)
if self:getStorageValue(1234) >= os.time() then
exp = exp * 2
end
return exp
end
@Damc - I believe so sir, perhaps I might be a little confused by your question though, do you mind sharing specifics behind the "group_id"? (in SQL presumably..)
[... other functions ...]
function Player:onGainExperience(source, exp, rawExp)
if self:getStorageValue(1234) >= os.time() then
exp = exp * 2
end
return exp
end
[... other functions ...]
If you modify the database when the server is running and the player is online then most likely any changes you've made will be lost, as the server stores most player data locally for performance reasons. When he/she logs out, any changes get overwritten. Once the bonus expires it should be possible to get it again. You can test it by setting the duration to a few seconds and then see if it works like you expect it to .@Damc - ahhh, I didn't add that to player.lua, now its working.
However, even with this set time, it appears the storage tables cannot be manually removed from the database. (it sticks to player)
Once the duration expires... will the double exp no longer last? Sorry if this sounds like a primitive question..
When i add this to my events.xml and kill a monster i only seem to get normal exp (5exp from a rat) and its not recognizing my stages or config file setup, anyone got an idea?