Ir para conteúdo

Featured Replies

Postado
  • Autor
21 minutos atrás, Joaovettor disse:

Poste aqui seu creaturescripts.xml

Spoiler

<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
    <event type="login" name="PlayerLogin" event="script" value="login.lua"/>
        <event type="death" name="Aol" event="script" value="aol.lua"/>
    <event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
    <event type="receivemail" name="Mail" event="script" value="mail.lua"/>
    <event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
    <event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/>

    <event type="think" name="Idle" event="script" value="idle.lua"/>
    <event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>
        <event type="death" name="Golgordan" script="golgordan.lua"/>
        <event type="death" name="Werewolf" script="werewolf.lua"/>
        <event type="death" name="Undead Gladiator" script="undead gladiator.lua"/>
        <event type="think" name="Courtel" event="script" value="Courtel.lua"/>  
        <event type="think" name="Vampire Bride" event="script" value="Vampire Bride.lua"/>
        <event type="think" name="Nifra" event="script" value="nifra.lua"/>
        <event type="outfit" name="Addons" event="script" value="outfits.lua"/>
    <event type="advance" name="lvlup" event="script" value="lvlup.lua"/>
    <event type="kill" name="Licznik" event="script" value="licznik.lua"/>
    <event type="think"  name="lottery" interval="10800" event="script" value="lottery.lua"/>

    <event type="kill" name="KillingInTheNameOf" event="script" value="killinginthenameof.lua"/>
    <event type="preparedeath" name="onPrepareDeath" event="script" value="preparedeath.lua"/>
    <event type="death" name="Reward" event="script" value="reward.lua"/>  
    <event type="login" name="Conected" script="conected.lua"/>
    <event type="advance" name="Advance" script="advance.lua"/>
        <event type="login" name="expRate" event="script" value="extraExpRate.lua"/>
    <event type="attack" name="AttackGuild" script="attackguild.lua"/>  
    <event type="kill" name="duszek" script="duszek.lua"/>
    <event type="login" name="fraglook_register" event="script" value="fraglook.lua"/> 
          <event type="look" name="fraglook" event="script" value="fraglook.lua"/>
    <event type="death" name="Portal" event="script" value="death portal.lua" />
    <event type="death" name="DeathBroadcast" event="script" value="deathBroadcast.lua"/>
    <event type="look" name="questlook" event="script" value="questlook.lua"/>
    <event type="death" name="metin_death" event="script" value="metin_kill.lua"/>  
    <event type="combat" name="Kamulec" event="script" value="metin_stones.lua"/>
        <event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>  
  
</creaturescripts>

 

4 minutos atrás, Noob II disse:

 

Se quiser pode adicionar, mas olha ai o seu script alterado com loot 

 

 

  Ocultar conteúdo

 



local config = {
    affected = 10, -- how many players (deathAssits) from table deathList should this script be executed for?
 
    killStorageValue = 3943,
    deathStorageValue = 3944,
 
    -- commands for the texts (those inside of ||, example: |KILLS| to show skills): KILLS, KILLERNAME, TARGETNAME
    rewardItem = {
        use = true,
        itemid = 5953,
        minLevel = false, -- false if you don't want any level req
        minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed).
        text = "This is a gift to |KILLERNAME| [|KILLERLEVEL|] for killing |TARGETNAME| [|TARGETLEVEL|]"
    },
 
    killMessage = {
        use = true,
        text = "You owned |TARGETNAME|! You have now |KILLERKILLS| kills!",
        messageClass = MESSAGE_STATUS_CONSOLE_BLUE
    },
 
    broadcastMessage = {
        use = true,
        minLevel = 350, -- false if you don't want any level req
        minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed).
        text = "|KILLERNAME| [|KILLERLEVEL|] just killed |TARGETNAME| [|TARGETLEVEL|]!",
        messageClass = MESSAGE_STATUS_WARNING
    },
 
    killerAnimation = {
        use = true,
        text = "Frag!", -- Only 9 letters! No "commands" here.
        color = 215
    },
 
    targetAnimation = {
        use = true,
        text = "Owned!", -- Only 9 letters! No "commands" here.
        color = 215
    }
}
 
function onDeath(cid, corpse, deathList)
    for i = 1, math.min(config.affected, getConfigInfo('deathAssistCount')) do
        local killer = deathList
        if(isPlayer(killer) == TRUE) then
            local targetKills = math.max(0, getPlayerStorageValue(cid, config.killStorageValue)) + 1
            local targetDeaths = math.max(0, getPlayerStorageValue(cid, config.deathStorageValue)) + 1
 
            local killerKills = math.max(0, getPlayerStorageValue(killer, config.killStorageValue)) + 1
            local killerDeaths = math.max(0, getPlayerStorageValue(killer, config.deathStorageValue)) + 1
 
            setPlayerStorageValue(killer, config.killStorageValue, targetKills)
            setPlayerStorageValue(cid, config.deathStorageValue, targetDeaths)
 
            local killerLevel = getPlayerLevel(killer)
            local targetLevel = getPlayerLevel(cid)
            local levelDiff = targetLevel - killerLevel
 
            local values = {
                ["KILLERKILLS"] = killerKills,
                ["KILLERDEATHS"] = killerDeaths,
                ["KILLERNAME"] = getCreatureName(killer),
                ["KILLERLEVEL"] = killerLevel,
 
                ["TARGETKILLS"] = targetKills,
                ["TARGETDEATHS"] = targetDeaths,
                ["TARGETNAME"] = getCreatureName(cid),
                ["TARGETLEVEL"] = targetLevel
            }
 
            function formateString(str)
                return(str:gsub("|([A-Z]+)|", (function(a) return values[a] end)))
            end
 
            if(config.rewardItem.use and (not config.rewardItem.minLevel or targetLevel >= config.rewardItem.minLevel) and (not config.rewardItem.minLevelDiff or levelDiff >= config.rewardItem.minLevelDiff)) then
                local uid = doPlayerAddItem(killer, config.rewardItem.itemid, 1)
             doItemSetAttribute(uid, "description", formateString(config.rewardItem.text))
             doItemSetAttribute(uid, "aid", "2222")
            end
            if(config.killMessage.use) then
                doPlayerSendTextMessage(killer, config.killMessage.messageClass, formateString(config.killMessage.text))
            end
            if(config.broadcastMessage.use and (not config.broadcastMessage.minLevel or getPlayerLevel(cid) >= config.broadcastMessage.minLevel) and (not config.broadcastMessage.minLevelDiff or levelDiff >= config.broadcastMessage.minLevelDiff)) then
                broadcastMessage(formateString(config.broadcastMessage.text), config.broadcastMessage.messageClass)
            end
            if(config.killerAnimation.use) then
                doSendAnimatedText(getCreaturePosition(killer), config.killerAnimation.text, config.killerAnimation.color)
            end
            if(config.targetAnimation.use) then
                doSendAnimatedText(getCreaturePosition(cid), config.targetAnimation.text, config.targetAnimation.color)
            end
            doCreatureSetDropLoot(cid, true)
        end
    end
 
    return true
end

 

 

Spoiler

[0:10:52.037] [Error - CreatureScript Interface] [0:10:52.037] data/creaturescripts/scripts/playerdeath.lua:onDeath [0:10:52.037] Description: [0:10:52.037] data/creaturescripts/scripts/playerdeath.lua:27: attempt to call field 'executeQuery' (a nil value) [0:10:52.037] stack traceback: [0:10:52.037] data/creaturescripts/scripts/playerdeath.lua:27: in function

 

  • Respostas 35
  • Visualizações 1.9k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Falta registrar o evento no login.lua!  adicione:  registerCreatureEvent(cid, "PlayerDeath")

  • Mathias Kenfi
    Mathias Kenfi

    Tirso baixe outro otserv, pega a pasta Data do seu otserv atual config.lua do seu otserv atual e coloque no outro, porque ai vai ficar tudo ok

Posted Images

Postado
5 minutos atrás, tirso disse:
  Mostrar conteúdo oculto

<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
    <event type="login" name="PlayerLogin" event="script" value="login.lua"/>
        <event type="death" name="Aol" event="script" value="aol.lua"/>
    <event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
    <event type="receivemail" name="Mail" event="script" value="mail.lua"/>
    <event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
    <event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/>

    <event type="think" name="Idle" event="script" value="idle.lua"/>
    <event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>
        <event type="death" name="Golgordan" script="golgordan.lua"/>
        <event type="death" name="Werewolf" script="werewolf.lua"/>
        <event type="death" name="Undead Gladiator" script="undead gladiator.lua"/>
        <event type="think" name="Courtel" event="script" value="Courtel.lua"/>  
        <event type="think" name="Vampire Bride" event="script" value="Vampire Bride.lua"/>
        <event type="think" name="Nifra" event="script" value="nifra.lua"/>
        <event type="outfit" name="Addons" event="script" value="outfits.lua"/>
    <event type="advance" name="lvlup" event="script" value="lvlup.lua"/>
    <event type="kill" name="Licznik" event="script" value="licznik.lua"/>
    <event type="think"  name="lottery" interval="10800" event="script" value="lottery.lua"/>

    <event type="kill" name="KillingInTheNameOf" event="script" value="killinginthenameof.lua"/>
    <event type="preparedeath" name="onPrepareDeath" event="script" value="preparedeath.lua"/>
    <event type="death" name="Reward" event="script" value="reward.lua"/>  
    <event type="login" name="Conected" script="conected.lua"/>
    <event type="advance" name="Advance" script="advance.lua"/>
        <event type="login" name="expRate" event="script" value="extraExpRate.lua"/>
    <event type="attack" name="AttackGuild" script="attackguild.lua"/>  
    <event type="kill" name="duszek" script="duszek.lua"/>
    <event type="login" name="fraglook_register" event="script" value="fraglook.lua"/> 
          <event type="look" name="fraglook" event="script" value="fraglook.lua"/>
    <event type="death" name="Portal" event="script" value="death portal.lua" />
    <event type="death" name="DeathBroadcast" event="script" value="deathBroadcast.lua"/>
    <event type="look" name="questlook" event="script" value="questlook.lua"/>
    <event type="death" name="metin_death" event="script" value="metin_kill.lua"/>  
    <event type="combat" name="Kamulec" event="script" value="metin_stones.lua"/>
        <event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>  
  
</creaturescripts>

 

  Ocultar conteúdo

[0:10:52.037] [Error - CreatureScript Interface] [0:10:52.037] data/creaturescripts/scripts/playerdeath.lua:onDeath [0:10:52.037] Description: [0:10:52.037] data/creaturescripts/scripts/playerdeath.lua:27: attempt to call field 'executeQuery' (a nil value) [0:10:52.037] stack traceback: [0:10:52.037] data/creaturescripts/scripts/playerdeath.lua:27: in function

 

 

Esse script que alterei é o deathBroadcast.lua e não o playerdeath.lua, você substituiu pelo playerdeath? 

apenas fiz oque você pediu ao cara acima > 

 

23 minutos atrás, tirso disse:

 

deathBroadcast

  Mostrar conteúdo oculto

local config = {
    affected = 10, -- how many players (deathAssits) from table deathList should this script be executed for?
 
    killStorageValue = 3943,
    deathStorageValue = 3944,
 
    -- commands for the texts (those inside of ||, example: |KILLS| to show skills): KILLS, KILLERNAME, TARGETNAME
    rewardItem = {
        use = true,
        itemid = 5953,
        minLevel = false, -- false if you don't want any level req
        minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed).
        text = "This is a gift to |KILLERNAME| [|KILLERLEVEL|] for killing |TARGETNAME| [|TARGETLEVEL|]"
    },
 
    killMessage = {
        use = true,
        text = "You owned |TARGETNAME|! You have now |KILLERKILLS| kills!",
        messageClass = MESSAGE_STATUS_CONSOLE_BLUE
    },
 
    broadcastMessage = {
        use = true,
        minLevel = 350, -- false if you don't want any level req
        minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed).
        text = "|KILLERNAME| [|KILLERLEVEL|] just killed |TARGETNAME| [|TARGETLEVEL|]!",
        messageClass = MESSAGE_STATUS_WARNING
    },
 
    killerAnimation = {
        use = true,
        text = "Frag!", -- Only 9 letters! No "commands" here.
        color = 215
    },
 
    targetAnimation = {
        use = true,
        text = "Owned!", -- Only 9 letters! No "commands" here.
        color = 215
    }
}
 
function onDeath(cid, corpse, deathList)
    for i = 1, math.min(config.affected, getConfigInfo('deathAssistCount')) do
        local killer = deathList
        if(isPlayer(killer) == TRUE) then
            local targetKills = math.max(0, getPlayerStorageValue(cid, config.killStorageValue)) + 1
            local targetDeaths = math.max(0, getPlayerStorageValue(cid, config.deathStorageValue)) + 1
 
            local killerKills = math.max(0, getPlayerStorageValue(killer, config.killStorageValue)) + 1
            local killerDeaths = math.max(0, getPlayerStorageValue(killer, config.deathStorageValue)) + 1
 
            setPlayerStorageValue(killer, config.killStorageValue, targetKills)
            setPlayerStorageValue(cid, config.deathStorageValue, targetDeaths)
 
            local killerLevel = getPlayerLevel(killer)
            local targetLevel = getPlayerLevel(cid)
            local levelDiff = targetLevel - killerLevel
 
            local values = {
                ["KILLERKILLS"] = killerKills,
                ["KILLERDEATHS"] = killerDeaths,
                ["KILLERNAME"] = getCreatureName(killer),
                ["KILLERLEVEL"] = killerLevel,
 
                ["TARGETKILLS"] = targetKills,
                ["TARGETDEATHS"] = targetDeaths,
                ["TARGETNAME"] = getCreatureName(cid),
                ["TARGETLEVEL"] = targetLevel
            }
 
            function formateString(str)
                return(str:gsub("|([A-Z]+)|", (function(a) return values[a] end)))
            end
 
            if(config.rewardItem.use and (not config.rewardItem.minLevel or targetLevel >= config.rewardItem.minLevel) and (not config.rewardItem.minLevelDiff or levelDiff >= config.rewardItem.minLevelDiff)) then
                local uid = doPlayerAddItem(killer, config.rewardItem.itemid, 1)
             doItemSetAttribute(uid, "description", formateString(config.rewardItem.text))
             doItemSetAttribute(uid, "aid", "2222")
            end
            if(config.killMessage.use) then
                doPlayerSendTextMessage(killer, config.killMessage.messageClass, formateString(config.killMessage.text))
            end
            if(config.broadcastMessage.use and (not config.broadcastMessage.minLevel or getPlayerLevel(cid) >= config.broadcastMessage.minLevel) and (not config.broadcastMessage.minLevelDiff or levelDiff >= config.broadcastMessage.minLevelDiff)) then
                broadcastMessage(formateString(config.broadcastMessage.text), config.broadcastMessage.messageClass)
            end
            if(config.killerAnimation.use) then
                doSendAnimatedText(getCreaturePosition(killer), config.killerAnimation.text, config.killerAnimation.color)
            end
            if(config.targetAnimation.use) then
                doSendAnimatedText(getCreaturePosition(cid), config.targetAnimation.text, config.targetAnimation.color)
            end
        end
    end
 
    return true
end

Aqui esta o script, pode continuar dando o item, queria só que o loot caisse, mais se nao der pode ficar sem mesmo 

 

Postado
  • Autor
2 minutos atrás, Noob II disse:

 

Esse script que alterei é o deathBroadcast.lua e não o playerdeath.lua, você substituiu pelo playerdeath? 

apenas fiz oque você pediu ao cara acima > 

 

 

Fiz nele mesmo :s

Nem o corpo caí no chão, ele some igual quando esta em arena..

Mesmo red ou black nao acontece nada.

Postado
5 minutos atrás, tirso disse:

Fiz nele mesmo :s

Nem o corpo caí no chão, ele some igual quando esta em arena..

Mesmo red ou black nao acontece nada.

 

Tá usando qual PlayerDeath? O que já tinha no servidor ou oque o Joaovettor postou? 

Troca o deathBroadcast por esse: 

 

local config = {
affected = 10, -- how many players (deathAssits) from table deathList should this script be executed for?
killStorageValue = 3943,
deathStorageValue = 3944,
-- commands for the texts (those inside of ||, example: |KILLS| to show skills): KILLS, KILLERNAME, TARGETNAME
rewardItem = {
use = true,
itemid = 5953,
minLevel = false, -- false if you don't want any level req
minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed).
},
killMessage = {
use = true,
text = ".",
messageClass = MESSAGE_STATUS_CONSOLE_BLUE
},
broadcastMessage = {
use = true,
minLevel = false, -- false if you don't want any level req
minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed).
text = "|KILLERNAME| [|KILLERLEVEL|] Matou |TARGETNAME| [|TARGETLEVEL|]!",
messageClass = MESSAGE_STATUS_WARNING
},
killerAnimation = {
use = true,
text = "Frag!", -- Only 9 letters! No "commands" here.
color = 144
},
targetAnimation = {
use = true,
text = "Owned!", -- Only 9 letters! No "commands" here.
color = 180
}
}
function onDeath(cid, corpse, deathList)
for i = 1, math.min(config.affected, getConfigInfo('deathAssistCount')) do
local killer = deathList
if(isPlayer(killer) == TRUE) then
local targetKills = math.max(0, getPlayerStorageValue(cid, config.killStorageValue)) + 1
local targetDeaths = math.max(0, getPlayerStorageValue(cid, config.deathStorageValue)) + 1
local killerKills = math.max(0, getPlayerStorageValue(killer, config.killStorageValue)) + 1
local killerDeaths = math.max(0, getPlayerStorageValue(killer, config.deathStorageValue)) + 1
setPlayerStorageValue(killer, config.killStorageValue, targetKills)
setPlayerStorageValue(cid, config.deathStorageValue, targetDeaths)
doCreatureSetDropLoot(cid, true)
local killerLevel = getPlayerLevel(killer)
local targetLevel = getPlayerLevel(cid)
local levelDiff = targetLevel - killerLevel
local values = {
["KILLERKILLS"] = killerKills,
["KILLERDEATHS"] = killerDeaths,
["KILLERNAME"] = getCreatureName(killer),
["KILLERLEVEL"] = killerLevel,
["TARGETKILLS"] = targetKills,
["TARGETDEATHS"] = targetDeaths,
["TARGETNAME"] = getCreatureName(cid),
["TARGETLEVEL"] = targetLevel
}
function formateString(str)
return(str:gsub("|([A-Z]+)|", (function(a) return values[a] end)))
end
if(config.rewardItem.use and (not config.rewardItem.minLevel or targetLevel >= config.rewardItem.minLevel) and (not config.rewardItem.minLevelDiff or levelDiff >= config.rewardItem.minLevelDiff)) then
local uid = doPlayerAddItem(killer, config.rewardItem.itemid, 1)
end
if(config.killMessage.use) then
doPlayerSendTextMessage(killer, config.killMessage.messageClass, formateString(config.killMessage.text))
end
if(config.broadcastMessage.use and (not config.broadcastMessage.minLevel or getPlayerLevel(cid) >= config.broadcastMessage.minLevel) and (not config.broadcastMessage.minLevelDiff or levelDiff >= config.broadcastMessage.minLevelDiff)) then
broadcastMessage(formateString(config.broadcastMessage.text), config.broadcastMessage.messageClass)
end
if(config.killerAnimation.use) then
doSendAnimatedText(getCreaturePosition(killer), config.killerAnimation.text, config.killerAnimation.color)
end
if(config.targetAnimation.use) then
doSendAnimatedText(getCreaturePosition(cid), config.targetAnimation.text, config.targetAnimation.color)
end
end
end
return true
end

Postado
  • Autor
5 minutos atrás, Noob II disse:

 

Tá usando qual PlayerDeath? O que já tinha no servidor ou oque o Joaovettor postou? 

Troca o deathBroadcast por esse: 

 

 


local config = {
affected = 10, -- how many players (deathAssits) from table deathList should this script be executed for?
killStorageValue = 3943,
deathStorageValue = 3944,
-- commands for the texts (those inside of ||, example: |KILLS| to show skills): KILLS, KILLERNAME, TARGETNAME
rewardItem = {
use = true,
itemid = 5953,
minLevel = false, -- false if you don't want any level req
minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed).
},
killMessage = {
use = true,
text = ".",
messageClass = MESSAGE_STATUS_CONSOLE_BLUE
},
broadcastMessage = {
use = true,
minLevel = false, -- false if you don't want any level req
minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed).
text = "|KILLERNAME| [|KILLERLEVEL|] Matou |TARGETNAME| [|TARGETLEVEL|]!",
messageClass = MESSAGE_STATUS_WARNING
},
killerAnimation = {
use = true,
text = "Frag!", -- Only 9 letters! No "commands" here.
color = 144
},
targetAnimation = {
use = true,
text = "Owned!", -- Only 9 letters! No "commands" here.
color = 180
}
}
function onDeath(cid, corpse, deathList)
for i = 1, math.min(config.affected, getConfigInfo('deathAssistCount')) do
local killer = deathList
if(isPlayer(killer) == TRUE) then
local targetKills = math.max(0, getPlayerStorageValue(cid, config.killStorageValue)) + 1
local targetDeaths = math.max(0, getPlayerStorageValue(cid, config.deathStorageValue)) + 1
local killerKills = math.max(0, getPlayerStorageValue(killer, config.killStorageValue)) + 1
local killerDeaths = math.max(0, getPlayerStorageValue(killer, config.deathStorageValue)) + 1
setPlayerStorageValue(killer, config.killStorageValue, targetKills)
setPlayerStorageValue(cid, config.deathStorageValue, targetDeaths)
doCreatureSetDropLoot(cid, true)
local killerLevel = getPlayerLevel(killer)
local targetLevel = getPlayerLevel(cid)
local levelDiff = targetLevel - killerLevel
local values = {
["KILLERKILLS"] = killerKills,
["KILLERDEATHS"] = killerDeaths,
["KILLERNAME"] = getCreatureName(killer),
["KILLERLEVEL"] = killerLevel,
["TARGETKILLS"] = targetKills,
["TARGETDEATHS"] = targetDeaths,
["TARGETNAME"] = getCreatureName(cid),
["TARGETLEVEL"] = targetLevel
}
function formateString(str)
return(str:gsub("|([A-Z]+)|", (function(a) return values[a] end)))
end
if(config.rewardItem.use and (not config.rewardItem.minLevel or targetLevel >= config.rewardItem.minLevel) and (not config.rewardItem.minLevelDiff or levelDiff >= config.rewardItem.minLevelDiff)) then
local uid = doPlayerAddItem(killer, config.rewardItem.itemid, 1)
end
if(config.killMessage.use) then
doPlayerSendTextMessage(killer, config.killMessage.messageClass, formateString(config.killMessage.text))
end
if(config.broadcastMessage.use and (not config.broadcastMessage.minLevel or getPlayerLevel(cid) >= config.broadcastMessage.minLevel) and (not config.broadcastMessage.minLevelDiff or levelDiff >= config.broadcastMessage.minLevelDiff)) then
broadcastMessage(formateString(config.broadcastMessage.text), config.broadcastMessage.messageClass)
end
if(config.killerAnimation.use) then
doSendAnimatedText(getCreaturePosition(killer), config.killerAnimation.text, config.killerAnimation.color)
end
if(config.targetAnimation.use) then
doSendAnimatedText(getCreaturePosition(cid), config.targetAnimation.text, config.targetAnimation.color)
end
end
end
return true
end

 

Playdeath

Spoiler

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 = getPlayerGUID(lastHitKiller)
        else
            hitKillerName = getCreatureName(lastHitKiller)
        end
        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

Spoiler

[1:16:31.773] [Error - CreatureScript Interface] [1:16:31.773] data/creaturescripts/scripts/playerdeath.lua:onDeath [1:16:31.773] Description: [1:16:31.773] data/creaturescripts/scripts/playerdeath.lua:27: attempt to call field 'executeQuery' (a nil value) [1:16:31.773] stack traceback: [1:16:31.773] data/creaturescripts/scripts/playerdeath.lua:27: in function

 

Editado por tirso
Segue o ERRO (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo