[FEATURE]: Method to add more/custom death causes dinamicaly
Scope
Developer API
Feature Description
It would be nice to have a system with which to add new causes of death without having to modify the resource code and run the risk of losing those modifications in future updates by not remembering to reapply the addition
Use Case
Currently I can only think of the case of addon weapons, I don't know if there can be any other case of non-vanilla deaths that can be detected from the log system.
Proposed Solution
Adding this code to cl_logger.lua (i haven't tested it yet, it's only a concept)
local function addDeathCause(weapon, name)
deathHashTable[GetHashKey(weapon)]=name
end
exports('addDeathCause',addDeathCause)
RegisterNetEvent('txAdmin:beta:addDeathCause')
AddEventHandler('txAdmin:beta:addDeathCause',addDeathCause)
Additional Info
No response
Death causes are defined by GTA
Also, the proposed solution wouldn't work without the API system
Death causes are defined by GTA
GTA only gives you the hash of the cause, and if this hash is not in the table used by txAdmin, the logger returns unknow, this snippet is to add more causes, mainly from addon weapons.
In this screenshot you can see that txAdmin does not recognize the addon weapon weapon_paintball.
I do not deny that the code is not the most suitable for the purpose.
exports('addDeathCause',addDeathCause)
This would require the full API system since at the moment that would be triggered by exports.monitor not exports.txAdmin, aswell as tx has no control over how its used, which is not good.
and as far as im aware, the api will be full exports, not events :)
So, once the API system is completed and done, this could be a solution, yes :)
Ok, now I understand what you mean, I put export because as far as I know it is safer, but also the events because it is what is being used at the moment, logically if this is implemented in the future API should use your system.
I really stated that it was a suggestion for the api because it was the most similar to what the suggestion is really for (web I understand that refers more to the web itself, and is not something for the menu)