potinho
Advanced OT User
Hello everyone, everything good? I'm using the frag reward system from the topic below, but when I killed a player my console showed an error and the reward (heart with ID 5280) was not delivered.
frag reward.lua
Error in console:
[Error - CreatureScript Interface]
data/creaturescripts/scripts/frag_reward.luanDeath
Description:
(luaGetCreatureName) Creature not found
[Error - CreatureScript Interface]
data/creaturescripts/scripts/frag_reward.luanDeath
Description:
(internalGetPlayerInfo) Player not found when requesting player info #3
CreatureEvent - Frag Reward: Trophy? Heart? Both? You Choose!
Hello again! Today I am sharing my latest frag reward script. There are other scripts released on this forum, even ones that may work, but I added some extra features. This script allows you to enable or disable, trophies and heart's as rewards. Hopefully you enjoy the convenience within this...
otland.net
frag reward.lua
Lua:
[LIST=1]
[*]local config = {
[*] useTrophy = "no", -- Use the trophy reward system?
[*] useHeart = "yes", -- Use the heart reward system?
[*] killers = 1 -- The # of people whom receive the reward.
[*]}
[*]
[*]local BRONZE, SILVER, GOLD = 10129, 10128, 10127
[*]function onDeath(cid, corpse, deathList)
[*] local reward, var = 0, {
[*] KILLER_NAME = getCreatureName(deathList),
[*] TARGET_NAME = getCreatureName(cid),
[*] KILLER_LEVEL = getPlayerLevel(deathList),
[*] TARGET_LEVEL = getPlayerLevel(cid)
[*] }
[*] config.useTrophy = getBooleanFromString(config.useTrophy)
[*] config.useHeart = getBooleanFromString(config.useHeart)
[*] local worldType = getConfigValue("worldType")
[*] if(worldType == "open") then
[*] for i = 1, config.killers do
[*] if(isPlayer(cid) and isPlayer(deathList)) then
[*] if(getPlayerIp(cid) ~= getPlayerIp(deathList)) then
[*]
[*] if(var.TARGET_LEVEL > 8 and var.TARGET_LEVEL < 100) then
[*] reward = BRONZE
[*] elseif(var.TARGET_LEVEL > 99 and var.TARGET_LEVEL < 200) then
[*] reward = SILVER
[*] elseif(var.TARGET_LEVEL > 199) then
[*] reward = GOLD
[*] end
[*]
[*] local trophy, heart = 0, 0
[*] if(config.useHeart) then
[*] heart = doAddContainerItem(corpse.uid, 5280, 1)
[*] end
[*] if(config.useTrophy) then
[*] trophy = doPlayerAddItem(deathList, reward, 1)
[*] end
[*]
[*] local killers = ""
[*] for i = 1, math.min(getConfigInfo('deathAssistCount') + 1, #deathList) do
[*] killers = killers .. (i == 1 and "" or ", ") .. (isMonster(deathList) and "a " or "") .. getCreatureName(deathList)
[*] end
[*] if(config.useHeart) then
[*] doItemSetAttribute(heart, "name", "Heart of " .. var.TARGET_NAME)
[*] doItemSetAttribute(heart, "description", "It was taken from " .. var.TARGET_NAME .. "'s body. " .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed at level " .. var.TARGET_LEVEL .. " by " .. var.KILLER_NAME .. ". " .. (getCreatureSkullType(cid) <= SKULL_GREEN and "(Unjustified)" or "(Justified)"))
[*] end
[*] if(config.useTrophy) then
[*] doItemSetAttribute(trophy, "description", "It was awarded to " .. var.KILLER_NAME .. " for killing " .. var.TARGET_NAME .. ". " .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed at level " .. var.TARGET_LEVEL .. " by " .. var.KILLER_NAME .. " who was level " .. var.KILLER_LEVEL .. " at the time. " .. (getCreatureSkullType(cid) <= SKULL_GREEN and "(Unjustified)" or "(Justified)"))
[*] end
[*] doSendMagicEffect(getThingPosition(cid), CONST_ME_MAGIC_RED)
[*] end
[*] end
[*] end
[*] end
[*] return true
[*]end
[/LIST]
Error in console:
[Error - CreatureScript Interface]
data/creaturescripts/scripts/frag_reward.luanDeath
Description:
(luaGetCreatureName) Creature not found
[Error - CreatureScript Interface]
data/creaturescripts/scripts/frag_reward.luanDeath
Description:
(internalGetPlayerInfo) Player not found when requesting player info #3