[Actions] EXP POTION / EXP MEDAL
Miłego czytania!

[Actions] EXP POTION / EXP MEDAL
#1
My??l?? ??e wielu z was szuka??o owego skryptu, musia??em niestety przysi?????? i sam go zrobi?? skrypt by?? testowany na TFS 0.4:
 
Do actions.xml dodajemy:

<pre class="_prettyXprint">
<action itemid="10140" event="script" value="exp.lua"/>
</pre>
P????niej wchodzimy w folder data/actions/script i nazywamy plik exp oraz wklejamy to:


<pre class="_prettyXprint">
local config = {
rate = 2, -- 4x More Experience
time = 1, -- Hours of Exp Time
storage = 20012
}
local function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
setPlayerStorageValue(cid, config.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, config.storage) < 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate is now: " .. config.rate .. ". It will last for ".. config.time .." hours.")
doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600)
addEvent(endExpRate, config.time * 3600 * 1000, cid)
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.")
end
return TRUE
end
</pre>
Potem przechodzimy do folderu creaturescripts i w pliku creaturescripts.xml dodajemy:

<pre class="_prettyXprint">
<event type="login" name="expRate" event="script" value="extraExpRate.lua"/>

</pre>
Po wykonaniu tego przechodzimy do creaturescripts/script/ i nazywamy plik extraExpRate oraz dodajemy w nim:

<pre class="_prettyXprint">
local config = {
rate = 2, -- 4x More Experience
storage = 20012
}
local function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
setPlayerStorageValue(cid, config.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end
end
function onLogin(cid)
local str = getPlayerStorageValue(cid, config.storage)
if(str >= 0 and (str - os.time()) > 0) then
doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your extra exp rate will expire at: " .. os.date("%X", str))
addEvent(endExpRate, (str - os.time()) * 1000, cid)
else
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You do not have any extra experience time.")
setPlayerStorageValue(cid, config.storage, -1)
end
return TRUE
end </pre>
Odpowiedz