• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Kill Reward!

Jordan_August

New Member
Joined
Jul 24, 2012
Messages
122
Reaction score
4
For the love of god could someone please hook me up with a kill reward script that actually works. i have tried every onkill/ondeath kill reward script on these forums and nothing works. yes they do reward the given id; However the killer a player with same ip never works. I need it to not give the kill reward to the person with the same ip. I am using 0.3.6 Please and Thank you in advance.

I have two different script that i have tried to modify over and over again and neither will work:
Script One:
Code:
local storage = 20233
local reward = {
        item = 2159,
        count = 1
}
function onKill(cid, target, flags, damage)
    if isPlayer(target) then
        if getPlayerIp(cid) ~= getPlayerIp(target) then
                local frags = math.max(0, getPlayerStorageValue(cid, storage))
                doCreatureSetStorage(cid, storage, frags+1)
                if(frags >= 5000) then
                    doCreatureSetGuildEmblem(cid, EMBLEM_RED)
                elseif(frags >= 1500) then
                    doCreatureSetGuildEmblem(cid, EMBLEM_BLUE)
                elseif(frags >= 250) then
                    doCreatureSetGuildEmblem(cid, EMBLEM_GREEN)
                end
               
                doSendAnimatedText(getPlayerPosition(cid), "Frag!", TEXTCOLOR_RED)
        else
            doPlayerSendTextMessage(cid, 18, "You didn't get frag/reward because of killing a player with same ip.")
        end
    return true
end

and script two:
Code:
function onKill(cid, target, lastHit)
    if cid ~= target and isPlayer(target) then
        if getPlayerIp(cid) == getPlayerIp(target) then
            doCreatureAddHealth(cid, -200)
            doPlayerAddExperience(cid, -171352)
            doCreatureAddMana(cid, -200)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have been punished for killing a player of the same IP.')
        else
            doPlayerAddItem(cid, 2159, 1)
            setPlayerStorageValue(cid, 6776, getCreatureStorage(cid, 6776) + 1)
        end
    end
    return true
end
 
Last edited:
why don't you try by urself?
I mean just use onKill(cid, target) and print some values then test and keep doing it btw I can do something for tfs 1.0 and then edit.
 
Code:
  function onKill(cid, target, lastHitKiller)
        if(isPlayer(lastHitKiller)) then
            local values = { KILLER_NAME = getCreatureName(lastHitKiller), KILLER_LEVEL = getPlayerLevel(lastHitKiller), TARGET_NAME = getCreatureName(target), TARGET_LEVEL = getPlayerLevel(target) }
            local reward = doPlayerAddItem(lastHitKiller, 2160, 3)
            doSendMagicEffect(getCreaturePosition(lastHitKiller), CONST_ME_GIFT_WRAPS)
            doSetItemSpecialDescription(reward, isPlayer(lastHitKiller) and "This is the heart of ".. values.TARGET_NAME ..". He was killed at level ".. values.TARGET_LEVEL .." by ".. values.KILLER_NAME .." who was level ".. values.KILLER_LEVEL .." at the time. " .. (getCreatureSkullType(target) <= SKULL_GREEN and "[Unjustified]" or "[Justified]") or "This is the heart of ".. values.TARGET_NAME ..". He was killed at level ".. values.TARGET_LEVEL .." by a ".. values.KILLER_NAME ..".")
            setItemName(reward, "".. values.TARGET_NAME .."'s Heart.")
        end
        return true
end

Code:
    <event type="kill" name="FragReward" script="fragreward.lua"/>
in login.lua add this
Code:
    registerCreatureEvent(cid, "FragReward")
 
Code:
  function onKill(cid, target, lastHitKiller)
        if(isPlayer(lastHitKiller)) then
            local values = { KILLER_NAME = getCreatureName(lastHitKiller), KILLER_LEVEL = getPlayerLevel(lastHitKiller), TARGET_NAME = getCreatureName(target), TARGET_LEVEL = getPlayerLevel(target) }
            local reward = doPlayerAddItem(lastHitKiller, 2160, 3)
            doSendMagicEffect(getCreaturePosition(lastHitKiller), CONST_ME_GIFT_WRAPS)
            doSetItemSpecialDescription(reward, isPlayer(lastHitKiller) and "This is the heart of ".. values.TARGET_NAME ..". He was killed at level ".. values.TARGET_LEVEL .." by ".. values.KILLER_NAME .." who was level ".. values.KILLER_LEVEL .." at the time. " .. (getCreatureSkullType(target) <= SKULL_GREEN and "[Unjustified]" or "[Justified]") or "This is the heart of ".. values.TARGET_NAME ..". He was killed at level ".. values.TARGET_LEVEL .." by a ".. values.KILLER_NAME ..".")
            setItemName(reward, "".. values.TARGET_NAME .."'s Heart.")
        end
        return true
end

Code:
    <event type="kill" name="FragReward" script="fragreward.lua"/>
in login.lua add this
Code:
    registerCreatureEvent(cid, "FragReward")

ill try this out. i pray to the gods it works lol. if not thanks for trying
 
Well I got a script from my war server it gives rewards whenever you kill someone example if you kill a guy you get like 5 cc pm me if you want it,
it workes on tfs 0.4 I think it workes on tfs 0.3.6
 
Its not giving a reward that is the issue im having. the issue i am having is if the person has the same ip. they wont get the reward. for some reason no matter what they always get the reward lol. But thanks for the offer :D
 
Code:
  function onKill(cid, target, lastHitKiller)
        if(isPlayer(lastHitKiller)) then
            local values = { KILLER_NAME = getCreatureName(lastHitKiller), KILLER_LEVEL = getPlayerLevel(lastHitKiller), TARGET_NAME = getCreatureName(target), TARGET_LEVEL = getPlayerLevel(target) }
            local reward = doPlayerAddItem(lastHitKiller, 2160, 3)
            doSendMagicEffect(getCreaturePosition(lastHitKiller), CONST_ME_GIFT_WRAPS)
            doSetItemSpecialDescription(reward, isPlayer(lastHitKiller) and "This is the heart of ".. values.TARGET_NAME ..". He was killed at level ".. values.TARGET_LEVEL .." by ".. values.KILLER_NAME .." who was level ".. values.KILLER_LEVEL .." at the time. " .. (getCreatureSkullType(target) <= SKULL_GREEN and "[Unjustified]" or "[Justified]") or "This is the heart of ".. values.TARGET_NAME ..". He was killed at level ".. values.TARGET_LEVEL .." by a ".. values.KILLER_NAME ..".")
            setItemName(reward, "".. values.TARGET_NAME .."'s Heart.")
        end
        return true
end

Code:
    <event type="kill" name="FragReward" script="fragreward.lua"/>
in login.lua add this
Code:
    registerCreatureEvent(cid, "FragReward")
This script did not work for me at all lol.. idk why but. thanks for trying.
 
Well this is my frag reward script :p

Code:
function onDeath(cid, corpse, deathList)
local reward = {
        item = 5953,
        count = 1
}
    for i = 1, #deathList do
        if isPlayer(cid) and isPlayer(deathList[i]) then
            --[[if getPlayerIp(cid) ~= getPlayerIp(deathList[i]) then    ]]--   
                if getPlayerItemCount(deathList[i], reward.item) > 0 then
                    local item = getPlayerItemById(deathList[i], true, reward.item)
                    if item.type >= ITEMCOUNT_MAX then
                        doPlayerAddItem(deathList[i], reward.item, reward.count)
                        doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
                        doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
                    else
                        doTransformItem(item.uid, reward.item, item.type + 1)
                        doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
                        doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
                    end
                else
                    doPlayerAddItem(deathList[i], reward.item, reward.count)
                    doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
                    doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
                end
            --[[else
                doPlayerSendTextMessage(deathList[i], 18, "You didn't get frag/reward because of killing a player with same ip.")
               
            end ]]--
        end
    end
    return true
end
 
Well this is my frag reward script :p

Code:
function onDeath(cid, corpse, deathList)
local reward = {
        item = 5953,
        count = 1
}
    for i = 1, #deathList do
        if isPlayer(cid) and isPlayer(deathList[i]) then
            --[[if getPlayerIp(cid) ~= getPlayerIp(deathList[i]) then    ]]-- 
                if getPlayerItemCount(deathList[i], reward.item) > 0 then
                    local item = getPlayerItemById(deathList[i], true, reward.item)
                    if item.type >= ITEMCOUNT_MAX then
                        doPlayerAddItem(deathList[i], reward.item, reward.count)
                        doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
                        doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
                    else
                        doTransformItem(item.uid, reward.item, item.type + 1)
                        doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
                        doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
                    end
                else
                    doPlayerAddItem(deathList[i], reward.item, reward.count)
                    doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
                    doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
                end
            --[[else
                doPlayerSendTextMessage(deathList[i], 18, "You didn't get frag/reward because of killing a player with same ip.")
             
            end ]]--
        end
    end
    return true
end
Thanks for trying. i just cant get this shit to work lol.. Any else got other suggestions?
 
You puttet In creaturescripts.xml
Code:
<!--event type="death" name="FragReward" event="script" value="fragreward.lua"/-->
 
Back
Top