• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent Kill/Death Tracker

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,890
Reaction score
459
Location
Texas
Requested by frankfarmer in our request thread. Some features not added yet. Not fully tested. Credits to Shawak for fix (if it works lol)
Lua:
function onKill(cid, target, lastHit)
        local config = {
                mc_protection = true,
                killsstorage = 43534,
                deathsstorage = 43535
        }

        if not isPlayer(target) then
                return true
        end
       
        if config.mc_protection and (getPlayerIp(cid) == getPlayerIp(target)) then
                return true
        end
       
        local tdeaths = getCreatureStorage(target, config.deathstorage) ~= -1 and getCreatureStorage(target, config.deathstorage) or 0
        local tkills = getCreatureStorage(target, config.killstorage) ~= -1 and getCreatureStorage(target, config.killstorage) or 0
        local ckills = getCreatureStorage(cid, config.killstorage) ~= -1 and getCreatureStorage(cid, config.killstorage) or 0
        local cdeaths = getCreatureStorage(cid, config.deathstorage) ~= -1 and getCreatureStorage(cid, config.deathstorage) or 0
               
        doCreatureSetStorage(cid, config.killsstorage, ckills+1)
        doCreatureSetStorage(target, config.deathsstorage, tdeaths+1)
        doPlayerSetSpecialDescription(cid, ". Frags [" ..ckills.."] Deaths ["..cdeaths.."] this week.")
        doPlayerSetSpecialDescription(target, ". Frags [" ..tkills.."] Deaths ["..tdeaths.."] this week.")
        return true
end
 
Last edited:
Testing it now

<event type="kill" name="frags" event="script" value="frags.lua
 
Last edited:
95% spam, 5% sense.

As unfortunate as it may be, I am in no way able to determine whether the script works properly or not. Good job nevertheless!
 
95% spam, 5% sense.

As unfortunate as it may be, I am in no way able to determine whether the script works properly or not. Good job nevertheless!

Well, players get 0 hp but they don't die. So, why don't they die?:(

It's not working.. yet :)


Note: I also have a "fragreward" script /another OnKill script. May they interrupt eachother?
 

Attachments

  • asdsadasdasdasdasdsadasdsadasdasdasd.PNG
    asdsadasdasdasdasdsadasdsadasdasdasd.PNG
    8 KB · Views: 36 · VirusTotal
Last edited:
Code:
20:13 You see Michukng (Level 9). He is a druid Frags [0] Deaths [0] this week..
Health: [190 / 190], Mana: [65 / 65].


W00t? Insane scripting mate!


but

Code:
20:13 You see Gudio (Level 8). He is a sorcerer Frags [-1] Deaths [-1] this week..

-1 frag?:d


Code:
20:14 You see Sinner (Level 9). He is a sorcerer Frags [6] Deaths [6] this week..


Code:
20:16 You see Why Reset (Level 8). He is a druid Frags [4] Deaths [4] this week..


There are some bugs, still?:d
 
make sure no other script is using those storage values, if so change em. But may be the script, I gotta goto work but ill fix and test when I get back tonight.

edit: one last update, reorganized and changed values, dunno what else till I can test on my own. PEace
 
Last edited:
make sure no other script is using those storage values, if so change em. But may be the script, I gotta goto work but ill fix and test when I get back tonight.

edit: one last update, reorganized and changed values, dunno what else till I can test on my own. PEace

I rather wait for you update mate.
 
Try this one:
Lua:
function onKill(cid, target, lastHit)
	local config = {
		mc_protection = true,
		killsstorage = 43534,
		deathsstorage = 43535
	}

        if not isPlayer(target) then
                return true
        end
       
        if config.mc_protection and (getPlayerIp(cid) == getPlayerIp(target)) then
                return true
        end
       
        local tdeaths = getCreatureStorage(target, config.deathstorage) ~= -1 and getCreatureStorage(target, config.deathstorage) or 0
        local tkills = getCreatureStorage(target, config.killstorage) ~= -1 and getCreatureStorage(target, config.killstorage) or 0
        local ckills = getCreatureStorage(cid, config.killstorage) ~= -1 and getCreatureStorage(cid, config.killstorage) or 0
        local cdeaths = getCreatureStorage(cid, config.deathstorage) ~= -1 and getCreatureStorage(cid, config.deathstorage) or 0
               
        doCreatureSetStorage(cid, config.killsstorage, ckills+1)
        doCreatureSetStorage(target, config.deathsstorage, tdeaths+1)
        doPlayerSetSpecialDescription(cid, ". Frags [" ..ckills+1.."] Deaths ["..cdeaths.."] this week.")
        doPlayerSetSpecialDescription(target, ". Frags [" ..tkills.."] Deaths ["..tdeaths+1.."] this week.")
	return true
end
 
Try this one:
Lua:
function onKill(cid, target, lastHit)
	local config = {
		mc_protection = true,
		killsstorage = 43534,
		deathsstorage = 43535
	}

        if not isPlayer(target) then
                return true
        end
       
        if config.mc_protection and (getPlayerIp(cid) == getPlayerIp(target)) then
                return true
        end
       
        local tdeaths = getCreatureStorage(target, config.deathstorage) ~= -1 and getCreatureStorage(target, config.deathstorage) or 0
        local tkills = getCreatureStorage(target, config.killstorage) ~= -1 and getCreatureStorage(target, config.killstorage) or 0
        local ckills = getCreatureStorage(cid, config.killstorage) ~= -1 and getCreatureStorage(cid, config.killstorage) or 0
        local cdeaths = getCreatureStorage(cid, config.deathstorage) ~= -1 and getCreatureStorage(cid, config.deathstorage) or 0
               
        doCreatureSetStorage(cid, config.killsstorage, ckills+1)
        doCreatureSetStorage(target, config.deathsstorage, tdeaths+1)
        doPlayerSetSpecialDescription(cid, ". Frags [" ..ckills+1.."] Deaths ["..cdeaths.."] this week.")
        doPlayerSetSpecialDescription(target, ". Frags [" ..tkills.."] Deaths ["..tdeaths+1.."] this week.")
	return true
end


Thanks, im testing now
 
Thanks, im testing now

Code:
[03/01/2010 17:04:36] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/frags.lua:23: malformed number near '1..'
[03/01/2010 17:04:36] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/frags.lua)
[03/01/2010 17:04:36] data/creaturescripts/scripts/frags.lua:23: malformed number near '1..'
 
Lua:
function onKill(cid, target, lastHit)
        local config = {
                mc_protection = true,
                killsstorage = 43534,
                deathsstorage = 43535
        }

        if not isPlayer(target) then
                return true
        end
       
        if config.mc_protection and (getPlayerIp(cid) == getPlayerIp(target)) then
                return true
        end
       
        local tdeaths = getCreatureStorage(target, config.deathstorage) ~= -1 and getCreatureStorage(target, config.deathstorage) or 0
        local tkills = getCreatureStorage(target, config.killstorage) ~= -1 and getCreatureStorage(target, config.killstorage) or 0
        local ckills = getCreatureStorage(cid, config.killstorage) ~= -1 and getCreatureStorage(cid, config.killstorage) or 0
        local cdeaths = getCreatureStorage(cid, config.deathstorage) ~= -1 and getCreatureStorage(cid, config.deathstorage) or 0
               
        doCreatureSetStorage(cid, config.killsstorage, ckills+1)
        doCreatureSetStorage(target, config.deathsstorage, tdeaths+1)
        doPlayerSetSpecialDescription(cid, ". Frags [" ..ckills.."] Deaths ["..cdeaths.."] this week.")
        doPlayerSetSpecialDescription(target, ". Frags [" ..tkills.."] Deaths ["..tdeaths.."] this week.")
        return true
end

Shawak you shouldn't need to add the storage again when writing the description...actually I don't even think you can do that, thats why its bugging. Up may work.
 
Lua:
function onKill(cid, target, lastHit)
        local config = {
                mc_protection = true,
                killsstorage = 43534,
                deathsstorage = 43535
        }

        if not isPlayer(target) then
                return true
        end
       
        if config.mc_protection and (getPlayerIp(cid) == getPlayerIp(target)) then
                return true
        end
       
        local tdeaths = getCreatureStorage(target, config.deathstorage) ~= -1 and getCreatureStorage(target, config.deathstorage) or 0
        local tkills = getCreatureStorage(target, config.killstorage) ~= -1 and getCreatureStorage(target, config.killstorage) or 0
        local ckills = getCreatureStorage(cid, config.killstorage) ~= -1 and getCreatureStorage(cid, config.killstorage) or 0
        local cdeaths = getCreatureStorage(cid, config.deathstorage) ~= -1 and getCreatureStorage(cid, config.deathstorage) or 0
               
        doCreatureSetStorage(cid, config.killsstorage, ckills+1)
        doCreatureSetStorage(target, config.deathsstorage, tdeaths+1)
        doPlayerSetSpecialDescription(cid, ". Frags [" ..ckills.."] Deaths ["..cdeaths.."] this week.")
        doPlayerSetSpecialDescription(target, ". Frags [" ..tkills.."] Deaths ["..tdeaths.."] this week.")
        return true
end

Shawak you shouldn't need to add the storage again when writing the description...actually I don't even think you can do that, thats why its bugging. Up may work.

Right, I'll test it again.
 
Right, I'll test it again.

Code:
01:21 You see Mastah (Level 9). He is a druid. Frags [938] Deaths [938] this week..

Code:
01:22 You see Gollum (Level 16). He is a druid. Frags [107] Deaths [107] this week..

Hmm?
 
lol? wtf, im stumped.never had this problem before, are the numbers just random, do they do anything after another kill?
 
lol? wtf, im stumped.never had this problem before, are the numbers just random, do they do anything after another kill?

Some players don't have shit, some players has those i showed you. Yes it's weird.

Anyway to make it easier, maybe in sources?
 
Sources would be an easier way, but don't feel like opening dev for you.
 
Sources would be an easier way, but don't feel like opening dev for you.

Oh, sorry.. for flaming your scripts mate. But let me look at it.. "THEY DON'T WORK" =D

Anyway, thanks for releasing a ground script.. i'll guess I have to ask around.


Hint: Before you do anymore scripts with your "scripting service", please test the scripts before releasing them.. else good job.
 
Back
Top Bottom