Zak.Tibiam
New Member
- Joined
- Mar 25, 2012
- Messages
- 150
- Reaction score
- 3
hi guys i am wanting to update this script to tfs 1.3 can anyone help me? It's from an 8.40 server that I played at the time. Thanks
---------------------------------
-----------------------------
---------------------------------
----------------------------------------
---------------------------------------
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
gem = gems.id[getPlayerVocation(cid)]
if item.itemid == gem then
doUseGem(cid, item, getPlayerVocation(cid))
end
return TRUE
end
Lua:
function doUseGem(cid, item)
local voc = getPlayerVocation(cid)
local interval = gems.interval[voc]
if item.itemid ~= gems.id[voc] or getPlayerStorageValue(cid, gems.storage[voc]) > 0 then
return FALSE
end
setPlayerStorageValue(cid, gems.storage[voc], 1)
sendGemEffect(cid, gems.storage[voc], gems.interval[voc])
doRemoveItem(item.uid, 1)
return TRUE
end
function sendGemEffect(cid, storage, interval)
local pos = getThingPos(cid)
local voc = getPlayerVocation(cid)
local color = 1
if voc == 1 then
color = gemMsg.colorDruid[math.random(1,#gemMsg.colorElderDruid)]
elseif voc == 2 then
color = gemMsg.colorSorcerer[math.random(1,#gemMsg.colorMasterSorcerer)]
elseif voc == 3 then
color = gemMsg.colorPaladin[math.random(1,#gemMsg.colorRoyalPaladin)]
elseif voc == 4 then
color = gemMsg.colorKnight[math.random(1,#gemMsg.colorEliteKnight)]
end
doSendAnimatedText(pos, gemMsg.rnd[math.random(1,#gemMsg.rnd)], color)
if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) >= 1 then
addEvent(sendGemEffect, interval, cid, storage, interval)
end
end
function doRemoveGemEffect(cid)
if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) < 1 then
return FALSE
end
setPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)], 0)
return TRUE
end
function doRemoveAllGemEffect(cid)
for i = 1, table.maxn(gms.storage) do
setPlayerStorageValue(cid, gems.storage[i], 0)
end
return TRUE
function isGemActivated(cid)
if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0 then
return TRUE
end
return FALSE
end
-----------------------------
Lua:
gems = {
id = {2156, 2155, 2158, 2154, 2156, 2155, 2158, 2154},
storage = {5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008},
interval = {750, 750, 750, 750, 750, 750, 750, 750}, -- Intervalo dos efeitos
}
gemMsg = {
rnd = {"´ . ,", ". ´ ,", "` . ,", ", ` ."},
colorDruid = {180,180},
colorSorcerer = {30,215},
colorPaladin = {251,10},
colorKnight = {204,212},
colorElderDruid = {180,180},
colorMasterSorcerer = {30,215},
colorRoyalPaladin = {251,10},
colorEliteKnight = {204,212}
}
---------------------------------
Lua:
local config =
{
minLevel = 200, -- Level mínimo para adquirir a gema.
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerLevel(cid) >= config.minLevel then
gem = gems.id[getPlayerVocation(cid)]
if item.itemid == gem then
doUseGem(cid, item, getPlayerVocation(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você adquiriu uma gema espíritual.")
doSendMagicEffect(getCreaturePosition(cid), 65)
end
else
doPlayerSendCancel(cid, "Voc\ê precisa ser level "..config.minLevel.." para adquirir a gema esp\íritual.")
end
return TRUE
end
----------------------------------------
Lua:
function onLogin(cid)
setPlayerStorageValue(cid, 47112120, 2)
local voc = getPlayerVocation(cid)
if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0 then
sendGemEffect(cid, gems.storage[voc], gems.interval[voc])
end
return TRUE
end
---------------------------------------