omigaaad
Banned User
- Joined
- Jun 29, 2010
- Messages
- 35
- Reaction score
- 8
This script is made for TFS 0.4
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Automatic Bless and Aol and Removing Talents" version="1.0" author="GarQet" contact="http://otland.net/members/garqet.30076/" enabled="yes">
<description>
</description>
<action itemid="8983" event="script"><![CDATA[
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
talents = 4595,
talents_hp = 25091,
talents_mp = 25092,
talents_dmg = 25093
}
doCreatureSay(cid, "Your talents have been reseted!", 20)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HEARTS)
local hp = getPlayerStorageValue(cid, config.talents_hp)
local mp = getPlayerStorageValue(cid, config.talents_mp)
local dmg = getPlayerStorageValue(cid, config.talents_dmg)
local note = getPlayerStorageValue(cid, config.talents)
local x = getPlayerLevel(cid)
local amount = getPlayerLevel(cid) - 1500000
local z = {}
for i = 1, 50 do
if x >= 50000 then
x = x - 50000
else
table.insert(z, i)
end
end
local dodaj = 0
if(z[1] <= 9) then
dodaj = 2 * z[1]
else
dodaj = (2 * 9) + (z[1] - 9)
end
if amount >= 50000 then
for i = 1, 50 do
if amount >= 50000 then
amount = amount - 50000
else
if(((i - 1) % 2) == 1) then
dodaj = dodaj - ((i) % 2)
else
dodaj = dodaj - ((i - 1) % 2)
end
end
end
end
setPlayerStorageValue(cid, config.talents_hp, 0)
setPlayerStorageValue(cid, config.talents_mp, 0)
setPlayerStorageValue(cid, config.talents_dmg, 0)
setPlayerStorageValue(cid, config.talents, dodaj)
doRemoveItem(item.uid, 1)
return true
end
]]></action>
<action itemid="8977" event="script"><![CDATA[
local function doPlayerAddAutoBless(cid, amount)
if(isPlayer(cid)) then
if(getPlayerStorageValue(cid, 250) == -1) then
setPlayerStorageValue(cid, 250, 0)
end
setPlayerStorageValue(cid, 250, getPlayerStorageValue(cid, 250) + amount)
if(getPlayerStorageValue(cid, 250) < -1) then
setPlayerStorageValue(cid, 250, 0)
end
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerLevel(cid) < 150000) then
doPlayerSendCancel(cid, "You level is too low, you need atleast min 150k level.")
return true
end
doCreatureSay(cid, "Automatic Bless and Aol has been activated for 30 days!", 20)
doSendMagicEffect(getCreaturePosition(cid), 49)
doPlayerAddAutoBless(cid, 30)
doPlayerAddItem(cid, 2173, 1)
for i = 1, 5 do
if(not getPlayerBlessing(cid, i)) then
doPlayerAddBlessing(cid, i)
end
end
doRemoveItem(item.uid, 1)
return true
end
]]></action>
<event type="login" name="Bless_Aol" event="script"><![CDATA[
local function getPlayerAutoBless(cid)
if(isPlayer(cid)) then
return getPlayerStorageValue(cid, 250)
end
end
function onLogin(cid)
if(getPlayerAutoBless(cid) >= 1) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have ".. getPlayerAutoBless(cid) .." days of auto bless and aol equip.")
doCreatureSay(cid, "Automatically blessed and amulet of loss equiped!", 20)
if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid ~= 2173 then
doPlayerAddItem(cid, 2173, 1)
end
for i = 1, 5 do
if(not getPlayerBlessing(cid, i)) then
doPlayerAddBlessing(cid, i)
end
end
doSendMagicEffect(getCreaturePosition(cid), 49)
end
return true
end
]]></event>
<globalevent name="AutoBlessing" time="23:59" event="script"><![CDATA[
function onTime(interval, lastExecution)
db.executeQuery("UPDATE `player_storage` SET `value` = `value` - 1 WHERE `key` = 250;");
return true
end
]]></globalevent>
</mod>