Can you help me How could i do this, I'm new to pocketmine. Here's how it would work. You would calculate how much DTR a faction gets by dividing its players by 2, for example, a 15 man faction would get a maximum of 7.5 DTR. That means when 8 people die, the faction goes raidable. When a faction is raidable, enemy factions can edit terrain, open chests, kill mobs, etc on there claimed land. DTR regenerates slowly, so if a faction got to 1 DTR, they could safely wait it out and they would get back up to their max DTR. A faction that goes raidable could do this too, but when they go raidable, there is a "DTR Freeze" where they stop regenerating, this should last about 2.5 hours.
so you just explained what you wanted: when player dies, subtract 1 from their DTR, if it's < 0 disable anti raid every so often, you will have a task to add 1 to their DTR, and stop if DTR is > fac's member / 2 OR if they are under a dtr freeze which can be compared using time() > frozenfor when a faction goes < 0 dtr, set it on dtr freeze with time() + 2.5hr which part of it you dont understand? and need me to help with you on?
for which part of it? part 1 there's a player death event i am pretty sure part 2 use task for these part 3 that can be added onto player death event where you subtracted the DTR
I'd suggest begin by assembling the "parts" you'll need for your "machine". I'd start with the easy stuff, like a DTR system. Begin by planning how that needs to be stored. YAML, JSON, SQLite? You decide. Create the functions to initialize and save DTR values, then the functions to add, subtract, etc. Then later on, you can just use those functions easily. Other parts include a method of checking whether an area is owned by a faction, and then whether that faction has enough DTR to be raided, etc. Just run that when you handle events for players breaking blocks, opening chests, etc. to determine whether to let the event run or to cancel it.