Raa
Senior User
- Joined
- Aug 9, 2009
- Messages
- 715
- Reaction score
- 50
- Age
- 29
Witam. Dzisiaj oddaj? w wasze r?ce jeden z moich skrypt?w, kt?re powsta?y na rzecz Raaevo. Mianowicie chodzi tu o exp scrolla.
#ps
Pisa?em go dosy? dawno i teraz jak tak na niego poatrz?, to s?dz?, ?e mo?na by go by?o nieco zoptymalizowa?.
Zaawansowany Exp Scroll
--
Jest to przedmiot kt?ry daje nam 6 godzin expienia z podw?jnym expem.. ale!
Czas kt?ry mamy do wykorzystania mo?e by? przez nas dowolnie zatrzymywany i wznawiany. Od tego s? specjalne komendy "!expscroll on" i "!expscroll off".
Wi?c je?eli postanowimy sobie pogada? pod depo etc. to mo?emy zatrzyma? czas i wznowi? kiedy nam to b?dzie potrzebne. Dodatowo wpisuj?c "!expscroll" mo?emy sprawdzi? ile nam zosta?o czasu.
--
--
Po wpisaniu "!expscroll off"
[LUA]<?xml version="1.0" encoding="utf-8"?>
<mod name="Exp Scroll" version="1.0" author="Rabbcio/Raa" contact="" enabled="yes">
<config name="Exp_Scroll"><![CDATA[
config = {
rate = 2,
storage = 5422,
register = 5424,
time = 3600*7,
on=5425
}
function isOn(cid)
if getPlayerStorageValue(cid, config.on) >0 then
return true
else
return false
end
end
]]></config>
<action itemid='9004' event='script'><![CDATA[
domodlib('Exp_Scroll')
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, config.storage) <= 0 then
local rates = getExperienceStage(getPlayerLevel(cid))
setPlayerStorageValue(cid, config.register, 1)
doCreatureSay(cid, "Your extra experience rate has been activated! It now is: " .. config.rate .. "x * former experience rate.", TALKTYPE_ORANGE_1, true, cid)
doPlayerSendTextMessage(cid, 22, "start")
doPlayerSetStorageValue(cid, config.storage, config.time+ os.time())
doPlayerSetStorageValue(cid, config.on, 1)
doPlayerSetStorageValue(cid, config.register, 1)
registerCreatureEvent(cid, "exp scroll think")
doPlayerSetExperienceRate(cid, config.rate)
doRemoveItem(item.uid,1)
else
doCreatureSay(cid, "You must finish first exp condition to start other exp condition !", TALKTYPE_ORANGE_1, true, cid)
end
return true
end ]]></action>
<event type="think" name="exp scroll think" event="script"><![CDATA[
domodlib('Exp_Scroll')
function onThink(cid, interval)
if getPlayerStorageValue(cid, config.register) == 1 then
if getPlayerStorageValue(cid, config.storage) <= os.time() then
doCreatureSay(cid, "Your extra experience rate has finished! It is now normaly experience rate.", TALKTYPE_ORANGE_1, true, cid)
setPlayerStorageValue(cid, config.storage, 0)
setPlayerStorageValue(cid, config.register, 0)
doPlayerSetStorageValue(cid, config.on, 0)
doPlayerSetExperienceRate(cid,1)
unregisterCreatureEvent(cid, "exp scroll think")
end
end
return true
end ]]></event>
<event type="login" name="exp scroll login" event="script"><![CDATA[
domodlib('Exp_Scroll')
function onLogin(cid)
if not isOn(cid) then
return true
end
if getPlayerStorageValue(cid, config.register) == 1 then
registerCreatureEvent(cid, "exp scroll think")
doPlayerSendTextMessage(cid, 22, "You stil have "..getClock(getPlayerStorageValue(cid, config.storage)+os.time())..".")
doCreatureSay(cid, "Your extra experience rate is still here! It is: " .. config.rate .. "x added to your former experience rate.", TALKTYPE_ORANGE_1, true, cid)
--if getPlayerStorageValue(cid, config.storage) < time then
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+ os.time())
--end
if getPlayerStorageValue(cid, config.storage) > os.time() then
doPlayerSetExperienceRate(cid, config.rate)
end
end
return true
end ]]></event>
<event type="logout" name="exp scroll logout" event="script"><![CDATA[
domodlib('Exp_Scroll')
function onLogout(cid)
if not isOn(cid) then
return true
end
if getPlayerStorageValue(cid, config.register) == 1 then
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)- os.time())
end
return true
end
]]>
</event>
<talkaction words='!expscroll' event='script'><![CDATA[
domodlib('Exp_Scroll')
function onSay(cid, words, param, channel)
if getPlayerStorageValue(cid, config.storage)<=0 then
doPlayerSendTextMessage(cid, 22, "You didn't use Exp Scroll.")
return true
end
if param=='' or param=='time' then
if not isOn(cid) then
doPlayerSendTextMessage(cid, 22, "You stil have "..getClock(getPlayerStorageValue(cid, config.storage)+os.time())..""..config.rate.."x exp.")
doPlayerSendTextMessage(cid, 22, "Exp Scroll now is off. Write '!expscroll on' to active it.")
return true
end
doPlayerSendTextMessage(cid, 22, "You stil have "..getClock(getPlayerStorageValue(cid, config.storage))..""..config.rate.."x exp.")
elseif param=='off' or param=='stop' then
if not isOn(cid) then
doPlayerSendTextMessage(cid, 22, "Exp Scroll is still off.")
return true
end
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)- os.time())
doPlayerSetStorageValue(cid, config.on, 0)
doPlayerSetExperienceRate(cid, 1)
unregisterCreatureEvent(cid, "exp scroll think")
doPlayerSendTextMessage(cid, 22, "stop")
return true
elseif param=='on' or param=='start' then
if isOn(cid) then
doPlayerSendTextMessage(cid, 22, "Exp Scroll is still on.")
return true
end
doPlayerSendTextMessage(cid, 22, "start")
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+ os.time())
doPlayerSetStorageValue(cid, config.on, 1)
registerCreatureEvent(cid, "exp scroll think")
doPlayerSetExperienceRate(cid, 2)
return true
end
return true
end
]]></talkaction>
</mod>[/LUA]
<mod name="Exp Scroll" version="1.0" author="Rabbcio/Raa" contact="" enabled="yes">
<config name="Exp_Scroll"><![CDATA[
config = {
rate = 2,
storage = 5422,
register = 5424,
time = 3600*7,
on=5425
}
function isOn(cid)
if getPlayerStorageValue(cid, config.on) >0 then
return true
else
return false
end
end
]]></config>
<action itemid='9004' event='script'><![CDATA[
domodlib('Exp_Scroll')
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, config.storage) <= 0 then
local rates = getExperienceStage(getPlayerLevel(cid))
setPlayerStorageValue(cid, config.register, 1)
doCreatureSay(cid, "Your extra experience rate has been activated! It now is: " .. config.rate .. "x * former experience rate.", TALKTYPE_ORANGE_1, true, cid)
doPlayerSendTextMessage(cid, 22, "start")
doPlayerSetStorageValue(cid, config.storage, config.time+ os.time())
doPlayerSetStorageValue(cid, config.on, 1)
doPlayerSetStorageValue(cid, config.register, 1)
registerCreatureEvent(cid, "exp scroll think")
doPlayerSetExperienceRate(cid, config.rate)
doRemoveItem(item.uid,1)
else
doCreatureSay(cid, "You must finish first exp condition to start other exp condition !", TALKTYPE_ORANGE_1, true, cid)
end
return true
end ]]></action>
<event type="think" name="exp scroll think" event="script"><![CDATA[
domodlib('Exp_Scroll')
function onThink(cid, interval)
if getPlayerStorageValue(cid, config.register) == 1 then
if getPlayerStorageValue(cid, config.storage) <= os.time() then
doCreatureSay(cid, "Your extra experience rate has finished! It is now normaly experience rate.", TALKTYPE_ORANGE_1, true, cid)
setPlayerStorageValue(cid, config.storage, 0)
setPlayerStorageValue(cid, config.register, 0)
doPlayerSetStorageValue(cid, config.on, 0)
doPlayerSetExperienceRate(cid,1)
unregisterCreatureEvent(cid, "exp scroll think")
end
end
return true
end ]]></event>
<event type="login" name="exp scroll login" event="script"><![CDATA[
domodlib('Exp_Scroll')
function onLogin(cid)
if not isOn(cid) then
return true
end
if getPlayerStorageValue(cid, config.register) == 1 then
registerCreatureEvent(cid, "exp scroll think")
doPlayerSendTextMessage(cid, 22, "You stil have "..getClock(getPlayerStorageValue(cid, config.storage)+os.time())..".")
doCreatureSay(cid, "Your extra experience rate is still here! It is: " .. config.rate .. "x added to your former experience rate.", TALKTYPE_ORANGE_1, true, cid)
--if getPlayerStorageValue(cid, config.storage) < time then
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+ os.time())
--end
if getPlayerStorageValue(cid, config.storage) > os.time() then
doPlayerSetExperienceRate(cid, config.rate)
end
end
return true
end ]]></event>
<event type="logout" name="exp scroll logout" event="script"><![CDATA[
domodlib('Exp_Scroll')
function onLogout(cid)
if not isOn(cid) then
return true
end
if getPlayerStorageValue(cid, config.register) == 1 then
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)- os.time())
end
return true
end
]]>
</event>
<talkaction words='!expscroll' event='script'><![CDATA[
domodlib('Exp_Scroll')
function onSay(cid, words, param, channel)
if getPlayerStorageValue(cid, config.storage)<=0 then
doPlayerSendTextMessage(cid, 22, "You didn't use Exp Scroll.")
return true
end
if param=='' or param=='time' then
if not isOn(cid) then
doPlayerSendTextMessage(cid, 22, "You stil have "..getClock(getPlayerStorageValue(cid, config.storage)+os.time())..""..config.rate.."x exp.")
doPlayerSendTextMessage(cid, 22, "Exp Scroll now is off. Write '!expscroll on' to active it.")
return true
end
doPlayerSendTextMessage(cid, 22, "You stil have "..getClock(getPlayerStorageValue(cid, config.storage))..""..config.rate.."x exp.")
elseif param=='off' or param=='stop' then
if not isOn(cid) then
doPlayerSendTextMessage(cid, 22, "Exp Scroll is still off.")
return true
end
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)- os.time())
doPlayerSetStorageValue(cid, config.on, 0)
doPlayerSetExperienceRate(cid, 1)
unregisterCreatureEvent(cid, "exp scroll think")
doPlayerSendTextMessage(cid, 22, "stop")
return true
elseif param=='on' or param=='start' then
if isOn(cid) then
doPlayerSendTextMessage(cid, 22, "Exp Scroll is still on.")
return true
end
doPlayerSendTextMessage(cid, 22, "start")
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+ os.time())
doPlayerSetStorageValue(cid, config.on, 1)
registerCreatureEvent(cid, "exp scroll think")
doPlayerSetExperienceRate(cid, 2)
return true
end
return true
end
]]></talkaction>
</mod>[/LUA]
#ps
Pisa?em go dosy? dawno i teraz jak tak na niego poatrz?, to s?dz?, ?e mo?na by go by?o nieco zoptymalizowa?.