A script that removes a character from the database in case of death with a certain chance

Hello everyone I’m just learning to write in LUA. I have an idea that I’m trying to implement on my server.

This is a script that will delete a character from the database in case of his death. I think I’m asking too much, but maybe someone can help me write the simplest version of this script without taking into account additional conditions?

In the future, I’m going to add additional conditions: being in a certain zone, belonging to a gang or faction, a murder weapon, and so on.

Im looking for a script lime this me too