D
Deleted member 49793
Guest
Looking for a script for 1.1 TFS that boosts a players exp for X minutes, (example 2 hours)
Anyone have one made or can put one together?
Anyone have one made or can put one together?
player:setStorageValue(1234, os.time() + 86400)
function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
if player:getStorageValue(1234) >= os.time() then
player:say('You already have double exp!', TALKTYPE_MONSTER_SAY)
return true
end
player:setStorageValue(1234, os.time() + 86400)
Item(item.uid):remove(1)
player:say('Your 24 hours of double XP has started!', TALKTYPE_MONSTER_SAY)
return true
end
function Player:onGainExperience(source, exp, rawExp)
if self:getStorageValue(1234) >= os.time() then
exp = exp * 2
end
return exp
end
You using tfs 1.1 or 1.2?Hmmm just tester this, added to actions.xml like soWhen using the item, it works, says the 2x exp is added, when i try and use another says it's already active, however I'm still receiving 1x exp.Code:<action itemid="1948" script="custom/expboost.lua"/>
@beastn
mmm that script was 100% working with 1.1... when you start your server up see what version it is i know i was using 1.2 without knowing hahaha anyways. Try this.1.1 :S
function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
if player:getStorageValue(1234) >= os.time() then
player:say('You already have double exp!', TALKTYPE_MONSTER_SAY)
return true
end
player:setStorageValue(1234, os.time() + 86400)
Item(item.uid):remove(1)
player:say('Your 24 hours of double XP has started!', TALKTYPE_MONSTER_SAY)
return true
end
if self:getStorageValue(1234) >= os.time() then
exp = exp * 2
end
-- Stamina modifier
if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
useStamina(self)
local staminaMinutes = self:getStamina()
if staminaMinutes > 2400 and self:isPremium() then
exp = exp * 1.5
elseif staminaMinutes <= 840 then
exp = exp * 0.5
end
end
mmm that script was 100% working with 1.1... when you start your server up see what version it is i know i was using 1.2 without knowing hahaha anyways. Try this.
/data/actions/script.lua
Code:function onUse(cid, item, fromPosition, itemEx, toPosition) local player = Player(cid) if player:getStorageValue(1234) >= os.time() then player:say('You already have double exp!', TALKTYPE_MONSTER_SAY) return true end player:setStorageValue(1234, os.time() + 86400) Item(item.uid):remove(1) player:say('Your 24 hours of double XP has started!', TALKTYPE_MONSTER_SAY) return true end
data/events/scripts/player.lua
Add this
Code:if self:getStorageValue(1234) >= os.time() then exp = exp * 2 end
after
Code:-- Stamina modifier if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then useStamina(self) local staminaMinutes = self:getStamina() if staminaMinutes > 2400 and self:isPremium() then exp = exp * 1.5 elseif staminaMinutes <= 840 then exp = exp * 0.5 end end
if self:getStorageValue(1234) >= os.time() then
exp = exp * 2
end
-- Stamina modifier
if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
useStamina(self)
local staminaMinutes = self:getStamina()
if staminaMinutes > 2400 and self:isPremium() then
exp = exp * 1.5
elseif staminaMinutes <= 840 then
exp = exp * 0.5
end
end
Getting the error data/events/scripts/player.lua attempt to index global 'self' <a nil value>
Line 184 in main chunk - Could not load player.lua
This is how I added it to player.lua
Code:if self:getStorageValue(1234) >= os.time() then exp = exp * 2 end -- Stamina modifier if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then useStamina(self) local staminaMinutes = self:getStamina() if staminaMinutes > 2400 and self:isPremium() then exp = exp * 1.5 elseif staminaMinutes <= 840 then exp = exp * 0.5 end end
http://pastebin.com/KnfJ38ESCould you copy & paste your whole player.lua file here: http://pastebin.com/ and send us the link.
Still getting same amount of exp before and after using scroll D:
Still getting same amount of exp before and after using scroll D:
<event class="Player" method="onGainExperience" enabled="1" />
Yes I am, that is exactly what I have an I restarted the server when I testedAre you testing on a non-god char? Double check that you enabled it in events.xml as well and make sure you /reload events
Code:<event class="Player" method="onGainExperience" enabled="1" />
Are you using exp stages?
mmm that script was 100% working with 1.1... when you start your server up see what version it is i know i was using 1.2 without knowing hahaha anyways. Try this.
/data/actions/script.lua
Code:function onUse(cid, item, fromPosition, itemEx, toPosition) local player = Player(cid) if player:getStorageValue(1234) >= os.time() then player:say('You already have double exp!', TALKTYPE_MONSTER_SAY) return true end player:setStorageValue(1234, os.time() + 86400) Item(item.uid):remove(1) player:say('Your 24 hours of double XP has started!', TALKTYPE_MONSTER_SAY) return true end
data/events/scripts/player.lua
Add this
Code:if self:getStorageValue(1234) >= os.time() then exp = exp * 2 end
after
Code:-- Stamina modifier if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then useStamina(self) local staminaMinutes = self:getStamina() if staminaMinutes > 2400 and self:isPremium() then exp = exp * 1.5 elseif staminaMinutes <= 840 then exp = exp * 0.5 end end
Hey its just like he said in the reply to me. The script works great. I asked for this long long ago, but i use it everyday on my server. If you need help installing it just pm mehello sir i really want to test this ot. but im not sure where to add all of these codes
Hey its just like he said in the reply to me. The script works great. I asked for this long long ago, but i use it everyday on my server. If you need help installing it just pm me
https://otland.net/threads/experience-scroll-lua.182974/#post-1771098im using tfs 0.3.6 and that script doesnt work for me. do u know how i can do it with mine?