igorlabanca
New Member
- Joined
- Aug 15, 2010
- Messages
- 36
- Reaction score
- 3
I really need to convert this script to tfs 1.2 because it is the most important of my server.
Note: shows no error
Thanks
Note: shows no error
Thanks
Code:
function onUse(cid, item, frompos, item2, topos)
local castle_one_name = "GH"
local storages = {154154,54321,123123}
local premio_por_vezes = 1
local premio_vezes = 1
local premio = 5956
local premio_cont = 1
local premio_reset = 1
local sto_ativ = getGlobalStorageValue(storages[2])
position = getCreaturePosition(cid)
local hora = tonumber(os.date("%H"))
if hora < 22 or hora > 22 then
doPlayerSendTextMessage(cid,18,"A Guild House só pode ser invadida entre as 22 e 23 horas.")
return true
end
if item.itemid == 9826 then
doTransformItem(9826)
doPlayerSendCancel(cid,"A Guild House ja foi invadida hoje.")
return false
end
if item.itemid == 9825 then
for posx = 1254,1256 do
for posy = 690,690 do
local pos = {x=posx, y=posy, z=6, stackpos=253}
local creature = getThingfromPos(pos)
if isMonster(creature.uid) then
doTransformItem(9825)
doPlayerSendTextMessage(cid,18,"Para dominar a guild house é necessario matar os guardas.")
return false
end
end
end
end
if isPlayerGuild(cid) == TRUE then
if sto_ativ == 1 or sto_ativ == -1 then
guildname = getPlayerGuildName(cid)
guild = getPlayerGuildId(cid)
guild_sto = getGlobalStorageValue(storages[3])
if guild ~= guild_sto then
setPlayerStorageValue(cid,guild_sto,guild)
if getPlayerStorageValue(cid,storages[1]) == -1 then
setPlayerStorageValue(cid,storages[1],0)
end
sto_vezes = getPlayerStorageValue(cid,storages[1])
setGlobalStorageValue(storages[3],getPlayerGuildId(cid))
setPlayerStorageValue(cid,storages[1], sto_vezes + 1)
sto_vezes_total = getPlayerStorageValue(cid,storages[1])
doPlayerSendTextMessage(cid, 18, "A guild "..getPlayerGuildName(cid).." acaba de dominar a Guild House de Dol\'Guldur!")
if premio_por_vezes == 1 then
if getPlayerStorageValue(cid,storages[1]) == premio_vezes then
if getItemWeightById(premio,1) <= getPlayerFreeCap(cid) then
doPlayerAddItem(cid, premio,premio_cont)
if premio_reset == 1 then
setPlayerStorageValue(cid,storages[1],0)
end
else
doPlayerSendTextMessage(cid, 18, "Voce nao tem capacidade para ganhar o item. Vamos verificar novamente em 10 segundos!")
addEvent(additem,10000,cid,premio,premio_cont,premio_reset)
end
end
end
else
doPlayerSendCancel(cid,"Sua guild já está dominando a guild house.")
doTransformItem(9825)
end
else
doPlayerSendCancel(cid,"O sistema está desativado")
end
else
doPlayerSendCancel(cid,"É nescessario ter guild para dominar a guild house.")
doTransformItem(9825)
end
end
function isPlayerGuild(cid)
if getPlayerGuildName(cid) ~= "" then
return TRUE
else
return FALSE
end
end