Ir para conteúdo
  • 0

Erro creature script


Lordfireot

Pergunta

eu to com outro erro

 

[error - creaturescript interface]

data/creaturescript/script/playerdeath.lua:ondeath

description

(luainterface::luagetcreaturename) creature not found

 

[error - creaturescript interface]

data/creaturescript/scripts/playerdeath.lua:ondeath

description

ddata/creaturescript/scripts/playerdeath.lua:15: in function <data/creaturescript/scripts/playerdeath.lua:1>

 

esse e meu erro agora meu arquivo playerdeath

 

function onDeath(cid, corpse, deathList)

 

local strings = {""}

local t, position = 1, 1

local deathType = "killed"

local toSlain, toCrushed = 3, 9

 

if #deathList >= toSlain then

deathType = "slain"

elseif #deathList >= toCrushed then

deathType = "crushed"

end

for _, pid in ipairs(deathList) do

strings[position] = t == 1 and "" or strings[position] .. ", "

strings[position] = strings[position] .. getCreatureName(pid) .. ""

t = t + 1

end

for i, str in ipairs(strings) do

if(str:sub(str:len()) ~= ",") then

str = str .. "."

end

msg = getCreatureName(cid) .. " was " .. deathType .. " at level " .. getPlayerLevel(cid) .. " by " .. str

end

for _, oid in ipairs(getPlayersOnline()) do

doPlayerSendChannelMessage(oid, "Death channel", msg, TALKTYPE_CHANNEL_O, CHANNEL_DEATH)

end

 

return true

end

 

 

alguem me ajuda pf

Link para o comentário
Compartilhar em outros sites

8 respostass a esta questão

Posts Recomendados

  • 0

Usa esse playerdeath.lua:

 

 

local config = {

deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),

sqlType = getConfigInfo('sqlType'),

maxDeathRecords = getConfigInfo('maxDeathRecords')

}

config.sqlType = config.sqlType == "sqlite" and DATABASE_ENGINE_SQLITE or DATABASE_ENGINE_MYSQL

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)

if(config.deathListEnabled ~= TRUE) then

return

end

local hitKillerName = "field item"

local damageKillerName = ""

if(lastHitKiller ~= FALSE) then

if(isPlayer(lastHitKiller) == TRUE) then

hitKillerName = getCreatureName(lastHitKiller)

else

hitKillerName = getCreatureName(lastHitKiller)

end

doBroadcastMessage(""..getPlayerName(cid).." has been killed by "..hitKillerName..".")

if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then

if(isPlayer(mostDamageKiller) == TRUE) then

damageKillerName = getPlayerGUID(mostDamageKiller)

else

damageKillerName = getCreatureName(mostDamageKiller)

end

end

end

db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")

local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")

if(rows:getID() ~= -1) then

local amount = rows:getRows(true) - config.maxDeathRecords

if(amount > 0) then

if(config.sqlType == DATABASE_ENGINE_SQLITE) then

for i = 1, amount do

db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")

end

else

db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")

end

end

end

end

 

Link para o comentário
Compartilhar em outros sites

  • 0

Não há de quê. Qualquer coisa, só criar um tópico aqui no xtibia que nós do xtibia tentaremos lhe ajudar. (não é que eu estou cobrando ou pedindo, mais você disse que deu rep+ mais não deu. worriedsmiley.gif)

Link para o comentário
Compartilhar em outros sites

  • 0

tente assim .

 

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
local config = {
deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
sqlType = getConfigInfo('sqlType'),
maxDeathRecords = getConfigInfo('maxDeathRecords')
}
config.sqlType = config.sqlType == "sqlite" and DATABASE_ENGINE_SQLITE or DATABASE_ENGINE_MYSQL
if(config.deathListEnabled ~= TRUE) then
return
end
local hitKillerName = "field item"
local damageKillerName = ""
if(lastHitKiller ~= FALSE) then
if(isPlayer(lastHitKiller) == TRUE) then
hitKillerName = getCreatureName(lastHitKiller)
else
hitKillerName = getCreatureName(lastHitKiller)
end
doBroadcastMessage(""..getPlayerName(cid).." has been killed by "..hitKillerName..".")
if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
if(isPlayer(mostDamageKiller) == TRUE) then
damageKillerName = getPlayerGUID(mostDamageKiller)
else
damageKillerName = getCreatureName(mostDamageKiller)
end
end
end
db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
if(rows:getID() ~= -1) then
local amount = rows:getRows(true) - config.maxDeathRecords
if(amount > 0) then
if(config.sqlType == DATABASE_ENGINE_SQLITE) then
for i = 1, amount do
db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
end
else
db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")
end
end
end
end

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...