• 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!

Player doesn't get skull when killing someone.

filipus

Member
Joined
Dec 31, 2010
Messages
229
Reaction score
12
So, i have set my redskull to be = 1 frag.
But what is happening is that when the users that is getting attacked (with no skull) defends himself (attacks the PK), if the PK kills him he doesn't get a redskull, only a white.
If the person getting attacked doesn't defend himself the PK gets a redskull.

I couldn't find anything that modified skulls on my files, does anyone know how to solve this?
Thanks, :D
 
config.lua have to stay similiar:
Code:
killsToRedSkull = 3
killsToBlackSkull = 6
pzLocked = 60000
timeToDecreaseFrags = 24 * 60 * 60 * 1000
whiteSkullTime = 15 * 60 * 1000

try to update your sources.
 
Didn't understand what you meant Techrlz, but here is my code
Code:
redSkullLength = 10 * 600 * 10000
blackSkullLength = 1 * 60 * 1000
dailyFragsToRedSkull = 1
weeklyFragsToRedSkull = 1
monthlyFragsToRedSkull = 1
dailyFragsToBlackSkull = 0
weeklyFragsToBlackSkull = 0
monthlyFragsToBlackSkull = 0
dailyFragsToBanishment = 10000
weeklyFragsToBanishment = 10000
monthlyFragsToBanishment = 10000
blackSkulledDeathHealth = 40
blackSkulledDeathMana = 40
useBlackSkull = false
useFragHandler = true
advancedFragList = true

So, I want that with 1 kill player gets Red skull.
Problem is when the player without skull defends himself and dies, the PK doesn't get a Red skul..
What should I update in the sources?
Kind of new to all this, trying to learn :)
 
We might be looking at different versions then. I have TFS 1.0.
On the other hand I just looked at my playerdeath.lua, and that doesn't set the skull color.

I need to go look for the script that runs when one player kills another one.
 
Not so much help unfortunately - so far I haven't been able to figure out how the event infrastructure works.
I'm not quite ready to give up though:

1. Please copy your creaturescripts.xml here

2. Please copy your login.lua here.

3. Please copy your playerdeath.lua here.

4. Please list the name of every script in your OT folder /creaturescripts/scripts
My TFS 1.o has only 3 scripts there: login.lua, playerdeath.lua, and firstitems.lua, so hopefully yours won't be a really long list :)
 
Mine is a really long list, and its really different. TFS 1.0 uses a different system based on 0.2, so posting my scripts here wont help.
I just checked again and none of them influence the skulls.
 
I wanted that stuff so I can try to see if your OT is even trying to run a "playerdeath" or "redskull" script. Your problem could as easily be caused by a missing script as by a script error. It's impossible to find out if you don't share some information.

Note that (4) asks for the names of those scripts, not the contents of the script files.

FWIW, here's how my TFS 1.0 is set up so the server can run playerdeath.lua:

in creaturescripts.xml:
Code:
<event type="death" name="PlayerDeath" script="playerdeath.lua"/>

in login.lua:
Code:
registerCreatureEvent(cid, "PlayerDeath")

the first few lines of playerdeath.lua:
Code:
dofile("./config.lua") -- make sure all the parameters in config.lua (like "killsToRedSkull") are available

function onDeath(cid, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
   doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You are dead.")

BTW: There seems to be enough information in this function's parameters to do everything you need. It has references to the creature that dies, the player that killed it, and it looks like those "mostDamage" fields are enough to decide who gets the credit for killing it: i.e it could be used to react when the active player is killed AND for the player who did the killing. OTOH one example isn't enough to understand the event OT infrastructure - e.g. there may be separate events for "player dies" and "player kills something".
 
@Pteryx
Sorry for not answering earlier, kind of crazy life here. And sorry for not posting the scripts, was a bit ridiculous of my part since you are trying to help me.

I will try to create a script using that code from TFS 1.0 but I doubt it will work, the systems are way different as far as I know.

Here is my creaturescript:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
<event type="login" name="PlayerLogin" event="script" value="login.lua"/>
<event type="login" name="FirstItems" event="script" value="firstitems.lua"/>
<event type="login" name="Lowlevellock" event="script" value="lowlevellock.lua"/>
<event type="login" name="fraglook_register" event="script" value="fraglook.lua"/>
<event type="advance" name="playeradvance" script="advance.lua"/>
<event type="advance" name="Addons" event="script" value="Addons.lua"/>
<event type="look" name="fraglook" event="script" value="fraglook.lua"/> 
<event type="death" name="DeathBroadcast" event="script" value="deathBroadcast.lua"/>
<event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
<event type="think" name="Idle" event="script" value="idle.lua"/>
<event type="death" name="deathcheck" event="script" value="death.lua"/>
<event type="login" name="LoanShark" event="script" value="loan shark.lua"/>
</creaturescripts>

and here is my deathbroadcast script
Code:
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 = 2152,
        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 = "You owned |TARGETNAME|! You have now |KILLERKILLS| kills!",
        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 Facil o  |TARGETNAME| [|TARGETLEVEL|]!",

        messageClass = MESSAGE_STATUS_WARNING
    },

    killerAnimation = {
        use = true,
        text = "Fraguei!", -- Only 9 letters! No "commands" here.
        color = 215
    },

    targetAnimation = {
        use = true,
        text = "Morreu!", -- 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[i]
        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, 5)
            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


I can't find anything that changes skulls.
I will even try to disable this script because Im not really using it haha
 
here is a creaturescript called fraglook.
Code:
--Script By Theax ""
function getPlayerFrags(cid)
    local time = os.time()
    local times = {today = (time - 86400), week = (time - (7 * 86400))}
    local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
    if(result:getID() ~= -1) then
        repeat
            local content = {date = result:getDataInt("date")}
            if(content.date > times.today) then
                table.insert(contents.day, content)
            elseif(content.date > times.week) then
                table.insert(contents.week, content)
            else
                table.insert(contents.month, content)
            end
        until not result:next()
        result:free()
    end
    local size = {
        day = table.maxn(contents.day),
        week = table.maxn(contents.week),
        month = table.maxn(contents.month)
    }
    return size.day + size.week + size.month
end
function onLogin(cid)
    registerCreatureEvent(cid, "fraglook")
    return true
end
function onLook(cid, thing, position, lookDistance)
    if isPlayer(thing.uid) and thing.uid ~= cid then
        doPlayerSetSpecialDescription(thing.uid,'[Frags: '..getPlayerFrags(thing.uid)..']')
        return true
    elseif thing.uid == cid then
        doPlayerSetSpecialDescription(cid,'[Frags: '..getPlayerFrags(cid)..']')
        local string = 'You see yourself.'
        if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
            string = string..' You are '.. getPlayerGroupName(cid) ..'.'
        elseif getPlayerVocation(cid) ~= 0 then
            string = string..' You are '.. getPlayerVocationName(cid) ..'.'
        else
            string = string..' You have no vocation.'
        end
        string = string..getPlayerSpecialDescription(cid)..''
        if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then
            string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.'
        end
        if getPlayerGuildId(cid) > 0 then
            string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid)
            string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.'
        end
        if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then
            string = string..'nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].'
            string = string..'nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.'
        end
        if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
            string = string..'nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].'
        end
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string) 
        return false
    end
    return true
end

anyone sees anything unusual?

Still can't solve this ):
 
Hi filipus

This is very helpful.

I think those two scripts are from different addons (different coding styles, different approaches to saving information about kills). They're both well coded though (not always true for user addons :) - it would be safe to modify them to add "red skull" support.

That plus the lack of red skull operations anywhere suggests to me that you either have a slightly bugged server, or you have one with the red skull global parameters, but no "red skull addon".
Bugged server would be true if the server was supposed to react to those parameters but doesn't.
Missing addon if the parameters are part of an addon, but you don't have the scripts. That's why I asked you to scan for red skull code - it tells us if the scripts are there but not started (e.g. due to a configuration error).

I think your next moves are:
1. Verify those two scripts are running correctly (I suggest you add some code that writes a short message to the OT console)
2. Check to see if there's a "red skull" addon somewhere that matches the configuration values you included in post #6

If there's no red skull addon to work with, but you want to try it yourself in Lua I can explain what to do, but I won't be able to do the actual coding.
 
Last edited:
awesomeguytalking.

I could't find anything BUT red skull is indeed working IF the player doesn't defend himself.
So, I would say that the server works with the global parameters, since I can't find any addon of it.
I'll test the code today and update this, thanks for helping!
 
Back
Top