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

TFS 1.2 Frag remover doesnt remove stored kills

Tbol

Well-Known Member
Joined
Apr 7, 2019
Messages
526
Reaction score
54
Hello
using action script that should remove all of my kills and my current white skull or red skull if i have one. It removes white skull fine (didnt tested with red skull) but it doesnt remove my stored kills that i have
Code:
You currently have 1 frags today, 1 this week and 1 this month.
and after using my frag remover it stays the same
but it should set all of my kills to 0, day, week, month, but it doesnt remove shitt

This is action script.
Lua:
local cooldown = 5 --time in seconds
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    if player:getExhaustion(Storage.FragRemoverCooldown) then
        player:sendCancelMessage("You are on cooldown.")
        return false
    end

    if player:getSkull() ~= SKULL_NONE then
        player:setSkull(SKULL_NONE)
    end

    player:setPlayerKillerEnd(0)
    player:setExhaustion(Storage.FragRemoverCooldown, cooldown)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your frags has been removed!")
    db.query("UPDATE `player_deaths` SET `unjustified` = 0 WHERE `unjustified` = 1 AND `killed_by` = " .. db.escapeString(player:getName()))
    item:remove(1)
    return true
end

Info from src that maybe might help idk
C++:
 for (auto kill : player->kills) {
        query.str(std::string());
        query << "INSERT INTO `player_kills` (`player_id`, `victim_id`, `time`) VALUES (" << player->getGUID() << "," << std::get<0>(kill) << "," << std::get<1>(kill) << ");";
        if (!db->executeQuery(query.str())) {
            return false;
        }
    }
C++:
 //load kills
    query.str(std::string());
    query << "SELECT `victim_id`,`time` FROM `player_kills` WHERE `player_id` = " << player->getGUID();
    if ((result = db->storeQuery(query.str()))) {
        do {
            player->kills.push_back(std::make_pair(result->getNumber<uint32_t>("victim_id"), result->getNumber<uint64_t>("time")));
        } while (result->next());
    }
 
Solution
Lua:
local cooldown = 5 --time in seconds
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    if player:getExhaustion(Storage.FragRemoverCooldown) then
        player:sendCancelMessage("You are on cooldown.")
        return false
    end

    if player:getSkull() ~= SKULL_NONE then
        player:setSkull(SKULL_NONE)
    end

    player:setPlayerKillerEnd(0)
    player:setExhaustion(Storage.FragRemoverCooldown, cooldown)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your frags has been removed!")
    item:remove(1)
    local playerId = player:getGuid();
    player:remove()
    addEvent(db.query, 10, "DELETE FROM `player_kills` WHERE `player_id` =...
Lua:
player:setSkullTime(0)
150981285d1acfdaf03f8c422cda2a5e.png
 
I mean, if you actually want them to be removed from the database you could use
Lua:
local cooldown = 5 --time in seconds
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    if player:getExhaustion(Storage.FragRemoverCooldown) then
        player:sendCancelMessage("You are on cooldown.")
        return false
    end

    if player:getSkull() ~= SKULL_NONE then
        player:setSkull(SKULL_NONE)
    end

    player:setPlayerKillerEnd(0)
    player:setExhaustion(Storage.FragRemoverCooldown, cooldown)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your frags has been removed!")
    db.query("DELETE FROM `player_deaths` WHERE `unjustified` = 1 AND `killed_by` = " .. db.escapeString(player:getName()))
    item:remove(1)
    return true
end
 
I mean, if you actually want them to be removed from the database you could use
Lua:
local cooldown = 5 --time in seconds
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    if player:getExhaustion(Storage.FragRemoverCooldown) then
        player:sendCancelMessage("You are on cooldown.")
        return false
    end

    if player:getSkull() ~= SKULL_NONE then
        player:setSkull(SKULL_NONE)
    end

    player:setPlayerKillerEnd(0)
    player:setExhaustion(Storage.FragRemoverCooldown, cooldown)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your frags has been removed!")
    db.query("DELETE FROM `player_deaths` WHERE `unjustified` = 1 AND `killed_by` = " .. db.escapeString(player:getName()))
    item:remove(1)
    return true
end
Nop still same
before
18:51 You currently have 1 frags today, 1 this week and 4 this month.
and after using this
18:51 You currently have 1 frags today, 1 this week and 4 this month.
frags are still the same
 
hmm probably works after relogging, so player:setSkullTime(0) should do the trick... but looks like you don't have that function (or it doesn't exist?)
 
hmm probably works after relogging, so player:setSkullTime(0) should do the trick... but looks like you don't have that function (or it doesn't exist?)
tried relogging still same. Yea i dont have player:setSkullTime(0) function, checked source and there is nothing about it.
 
This would kick the player, so maybe check if player is currently pzlocked before being able to use the item
Lua:
local cooldown = 5 --time in seconds
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    if player:getExhaustion(Storage.FragRemoverCooldown) then
        player:sendCancelMessage("You are on cooldown.")
        return false
    end

    if player:getSkull() ~= SKULL_NONE then
        player:setSkull(SKULL_NONE)
    end

    player:setPlayerKillerEnd(0)
    player:setExhaustion(Storage.FragRemoverCooldown, cooldown)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your frags has been removed!")
    item:remove(1)
    local playerName = player:getName();
    player:remove()
    addEvent(db.query, 10, "DELETE FROM `player_deaths` WHERE `unjustified` = 1 AND `killed_by` = " .. db.escapeString(playerName))
    return true
end
 
This would kick the player, so maybe check if player is currently pzlocked before being able to use the item
Lua:
local cooldown = 5 --time in seconds
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    if player:getExhaustion(Storage.FragRemoverCooldown) then
        player:sendCancelMessage("You are on cooldown.")
        return false
    end

    if player:getSkull() ~= SKULL_NONE then
        player:setSkull(SKULL_NONE)
    end

    player:setPlayerKillerEnd(0)
    player:setExhaustion(Storage.FragRemoverCooldown, cooldown)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your frags has been removed!")
    item:remove(1)
    local playerName = player:getName();
    player:remove()
    addEvent(db.query, 10, "DELETE FROM `player_deaths` WHERE `unjustified` = 1 AND `killed_by` = " .. db.escapeString(playerName))
    return true
end
Still doesnt remove
 
Lua:
local cooldown = 5 --time in seconds
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    if player:getExhaustion(Storage.FragRemoverCooldown) then
        player:sendCancelMessage("You are on cooldown.")
        return false
    end

    if player:getSkull() ~= SKULL_NONE then
        player:setSkull(SKULL_NONE)
    end

    player:setPlayerKillerEnd(0)
    player:setExhaustion(Storage.FragRemoverCooldown, cooldown)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your frags has been removed!")
    item:remove(1)
    local playerName = player:getName();
    player:remove()
    addEvent(db.query, 10, "DELETE FROM `player_deaths` WHERE `killed_by` = " .. db.escapeString(playerName))
    return true
end
 
Lua:
local cooldown = 5 --time in seconds
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    if player:getExhaustion(Storage.FragRemoverCooldown) then
        player:sendCancelMessage("You are on cooldown.")
        return false
    end

    if player:getSkull() ~= SKULL_NONE then
        player:setSkull(SKULL_NONE)
    end

    player:setPlayerKillerEnd(0)
    player:setExhaustion(Storage.FragRemoverCooldown, cooldown)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your frags has been removed!")
    item:remove(1)
    local playerId = player:getGuid();
    player:remove()
    addEvent(db.query, 10, "DELETE FROM `player_kills` WHERE `player_id` = " .. playerId)
    return true
end
 
Solution
Back
Top