• 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.X+ Old System Kills old school tfs 1.5 7.72

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
941
Solutions
7
Reaction score
129
Location
Brazil
YouTube
caruniawikibr
hello guys, I have an old system, where there is no blacskull. the player has redskull and ban like old times.
however I have a table in my database that counts the kills.
however there is a problem, let's say I remove the player's skull and the ban. then the "player_murders" continues without updating, so when the player loses redskull/ban he kills 1 person he is banned again. can anybody help me?

the table in mysql
XML:
CREATE TABLE `player_murders` (
  `id` bigint(20) NOT NULL,
  `player_id` int(11) NOT NULL,
  `date` bigint(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

my config data
Lua:
-- Red Skull
killsDayRedSkull = 3
killsWeekRedSkull = 5
killsMonthRedSkull = 10
-- Ban
killsDayBanishment = 5
killsWeekBanishment = 10
killsMonthBanishment = 20
redSkullTime = 30 * 24 * 60 * 60


if i remove skull in player in the table and the ban in account_ban
and the player kills 1 person he is banned again.
 
Not tested
Lua:
function Player.truncateFrags(self)
  return db.query(("DELETE FROM `player_murders` WHERE `player_id` = %d"):format(self:getId()))
end
Usage where you remove frags:
Lua:
player:truncateFrags()

Enjoy errors since not tested and I don't have an working TFS 1.X+ environment set up 😒
 
Excuse my ignorance, but where do I apply?

iologindata.cpp


Lua:
    std::ostringstream query;

    query << "SELECT `date` FROM `player_murders` WHERE `player_id` = " << player->getGUID() << " ORDER BY `date` ASC";
    if ((result = db.storeQuery(query.str()))) {
        do {
            player->murderTimeStamps.push_back(result->getNumber<time_t>("date"));
        } while (result->next());
    }

    query.str(std::string());
 
Last edited:
nope

Code:
function Player.truncateFrags(self)
  return db.query(("DELETE FROM `player_murders` WHERE `player_id` = %d"):format(self:getId()))
end

add this in data/lib/core/player.lua after the last line

and you can use player:truncateFrags() in the code that bans players when they reach X kills so before ban you need to add the function player:truncateFrags()
 
nope

Code:
function Player.truncateFrags(self)
  return db.query(("DELETE FROM `player_murders` WHERE `player_id` = %d"):format(self:getId()))
end

add this in data/lib/core/player.lua after the last line

and you can use player:truncateFrags() in the code that bans players when they reach X kills so before ban you need to add the function player:truncateFrags()
" in the code that bans players when they reach X kills so before ban you need to add the function player:truncateFrags()"
where is that code? in source or in the datapack itself?
 
Back
Top