hello Otland
I have a problem with Script TalkAction, It works once and gets stuck with some people and I don't know why
Knowing that the first time it does not register list look Createscript
Tibia 8.60
Engine : OTX 2
I have a problem with Script TalkAction, It works once and gets stuck with some people and I don't know why
Knowing that the first time it does not register list look Createscript
Tibia 8.60
Engine : OTX 2
LUA:
function onSay(cid, words, param)
local maximum = {
player = getPlayerGUID(cid),
lvlmax = 8
}
if getPlayerStorageValue(cid, 14335) < 0 then
if getPlayerLevel(cid) >= 500 then
setPlayerStorageValue(cid, 14335, getPlayerStorageValue(cid, 14335) + 1)
setCreatureMaxHealth(cid, 500)
setCreatureMaxMana(cid, 500)
doCreatureAddMana(cid, 500)
doCreatureAddHealth(cid, 500)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você renasceu com sucesso!")
doRemoveCreature(cid)
db.executeQuery("UPDATE players SET level = " .. maximum.lvlmax .. ", experience = 10000 WHERE id = " .. maximum.player)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa ser level 500 para renascer.")
end
elseif getPlayerStorageValue(cid, 14335) < 1 then
if getPlayerLevel(cid) >= 1000 then
setPlayerStorageValue(cid, 14335, getPlayerStorageValue(cid, 14335) + 1)
setCreatureMaxHealth(cid, 1000)
setCreatureMaxMana(cid, 1000)
doCreatureAddMana(cid, 1000)
doCreatureAddHealth(cid, 1000)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você renasceu com sucesso!")
doRemoveCreature(cid)
db.executeQuery("UPDATE players SET level = " .. maximum.lvlmax .. ", experience = 10000 WHERE id = " .. maximum.player)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa ser level 1000 para renascer.")
end
elseif getPlayerStorageValue(cid, 14335) < 2 then
if getPlayerLevel(cid) >= 2000 then
setPlayerStorageValue(cid, 14335, getPlayerStorageValue(cid, 14335) + 1)
setCreatureMaxHealth(cid, 1500)
setCreatureMaxMana(cid, 1500)
doCreatureAddMana(cid, 1500)
doCreatureAddHealth(cid, 1500)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você renasceu com sucesso!")
doRemoveCreature(cid)
db.executeQuery("UPDATE players SET level = " .. maximum.lvlmax .. ", experience = 10000 WHERE id = " .. maximum.player)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa ser level 2000 para renascer.")
end
elseif getPlayerStorageValue(cid, 14335) < 3 then
if getPlayerLevel(cid) >= 3000 then
setPlayerStorageValue(cid, 14335, getPlayerStorageValue(cid, 14335) + 1)
setCreatureMaxHealth(cid, 2000)
setCreatureMaxMana(cid, 2000)
doCreatureAddMana(cid, 2000)
doCreatureAddHealth(cid, 2000)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você renasceu com sucesso!")
doRemoveCreature(cid)
db.executeQuery("UPDATE players SET level = " .. maximum.lvlmax .. ", experience = 10000 WHERE id = " .. maximum.player)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa ser level 3000 para renascer.")
end
elseif getPlayerStorageValue(cid, 14335) < 4 then
if getPlayerLevel(cid) >= 3500 then
setPlayerStorageValue(cid, 14335, getPlayerStorageValue(cid, 14335) + 1)
setCreatureMaxHealth(cid, 2500)
setCreatureMaxMana(cid, 2500)
doCreatureAddMana(cid, 2500)
doCreatureAddHealth(cid, 2500)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você renasceu com sucesso!")
doRemoveCreature(cid)
db.executeQuery("UPDATE players SET level = " .. maximum.lvlmax .. ", experience = 10000 WHERE id = " .. maximum.player)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa ser level 3500 para renascer.")
end
elseif getPlayerStorageValue(cid, 14335) < 5 then
if getPlayerLevel(cid) >= 4000 then
setPlayerStorageValue(cid, 14335, getPlayerStorageValue(cid, 14335) + 1)
setCreatureMaxHealth(cid, 3000)
setCreatureMaxMana(cid, 3000)
doCreatureAddMana(cid, 3000)
doCreatureAddHealth(cid, 3000)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você renasceu com sucesso!")
doRemoveCreature(cid)
db.executeQuery("UPDATE players SET level = " .. maximum.lvlmax .. ", experience = 10000 WHERE id = " .. maximum.player)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa ser level 4000 para renascer.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você já renasceu o máximo de vezes.")
end
return true
end
Code:
function getPlayerFrags(cid)
local time = os.time()
local times = {today = (time - 86400), week = (time - (7 * 86400))}
local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
if(result:getID() ~= -1) then
repeat
local content = {date = result:getDataInt("date")}
if(content.date > times.today) then
table.insert(contents.day, content)
elseif(content.date > times.week) then
table.insert(contents.week, content)
else
table.insert(contents.month, content)
end
until not result:next()
result:free()
end
local size = {
day = table.maxn(contents.day),
week = table.maxn(contents.week),
month = table.maxn(contents.month)
}
return size.day + size.week + size.month
end
function onLogin(cid)
registerCreatureEvent(cid, "fraglook")
return true
end
function onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid) and thing.uid ~= cid then
doPlayerSetSpecialDescription(thing.uid,' [Frags: '..getPlayerFrags(thing.uid)..'], [Reborn: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,14335)) or 0))..'], [Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,98798644)) or 0))..']')
return true
elseif thing.uid == cid then
doPlayerSetSpecialDescription(cid,' [Frags: '..getPlayerFrags(cid)..'], [Reborn: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,14335)) or 0))..'], [Critical: '..math.max(0,(tonumber(getCreatureStorage(cid,48903)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(cid,98798644)) or 0))..']')
local string = 'You see yourself.'
if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
string = string..' You are '.. getPlayerGroupName(cid) ..'.'
elseif getPlayerVocation(cid) ~= 0 then
string = string..' You are '.. getPlayerVocationName(cid) ..'.'
else
string = string..' You have no vocation.'
end
string = string..getPlayerSpecialDescription(cid)..''
if getPlayerGuildId(cid) > 0 then
string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid)
string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.'
end
if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then
string = string..'\nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].'
string = string..'\nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.'
end
if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
string = string..'\nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].'
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)
return false
end
return true
end