feat: add controlled FiveM test telemetry
This commit is contained in:
@@ -21,6 +21,14 @@ secretele nu fac parte din commituri.
|
|||||||
- Validare: restart individual al resursei fără un nou warning
|
- Validare: restart individual al resursei fără un nou warning
|
||||||
`could not find file`.
|
`could not find file`.
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- `rv-ai-test-tools`: resursă internă DEV pentru telemetrie tehnică
|
||||||
|
structurată între gameplay/F8, consola FXServer și CompanyFloor.
|
||||||
|
- Nu modifică bani, inventar, vehicule sau baza de date.
|
||||||
|
- Evenimentele sunt limitate ca frecvență și nu includ credentiale ori loguri
|
||||||
|
F8 brute.
|
||||||
|
|
||||||
### Scope
|
### Scope
|
||||||
|
|
||||||
- Nu include schimbările Gabz, Luxu, `server.cfg`, `start.bat`,
|
- Nu include schimbările Gabz, Luxu, `server.cfg`, `start.bat`,
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# rv-ai-test-tools
|
||||||
|
|
||||||
|
Sursa canonică pentru resursa internă Red Valley de verificări controlate în mediul local DEV.
|
||||||
|
|
||||||
|
- Nu modifică bani, inventar, vehicule sau baza de date.
|
||||||
|
- Nu trimite HTTP și nu conține credentiale.
|
||||||
|
- Scrie mesaje tehnice prefixate `AI_TEST_TELEMETRY` în consola FXServer.
|
||||||
|
- În joc, comanda F8 `/aiteststatus` confirmă că resursa client rulează.
|
||||||
|
|
||||||
|
Deploy-ul în FiveM este o copie controlată în `E:\FiveMserver\server\resources\[framework]\[addons]\rv-ai-test-tools`. Rulează întâi scriptul de sincronizare fără `-Apply` pentru verificarea diferențelor. Resursa intră la următorul restart normal al FXServer prin grupa deja existentă `[addons]`.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
local function reportClientState(reason)
|
||||||
|
TriggerServerEvent("rv-ai-test-tools:server:clientState", {
|
||||||
|
reason = reason,
|
||||||
|
resource_state = GetResourceState(GetCurrentResourceName()),
|
||||||
|
game_timer_ms = GetGameTimer(),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
AddEventHandler("onClientResourceStart", function(resourceName)
|
||||||
|
if resourceName == GetCurrentResourceName() then
|
||||||
|
reportClientState("client_resource_started")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
RegisterCommand("aiteststatus", function()
|
||||||
|
reportClientState("manual_f8_status")
|
||||||
|
TriggerEvent("chat:addMessage", {
|
||||||
|
color = { 0, 190, 255 },
|
||||||
|
args = { "AI TEST", "Status trimis către consola DEV." },
|
||||||
|
})
|
||||||
|
end, false)
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
fx_version "cerulean"
|
||||||
|
game "gta5"
|
||||||
|
lua54 "yes"
|
||||||
|
|
||||||
|
author "Red Valley"
|
||||||
|
description "Controlled DEV telemetry for Hermes and CompanyFloor"
|
||||||
|
version "0.1.0"
|
||||||
|
|
||||||
|
shared_script "shared/config.lua"
|
||||||
|
|
||||||
|
client_script "client/main.lua"
|
||||||
|
server_script "server/main.lua"
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
local lastReportAt = {}
|
||||||
|
|
||||||
|
local function emitTelemetry(eventName, payload)
|
||||||
|
local event = {
|
||||||
|
protocol_version = Config.ProtocolVersion,
|
||||||
|
source = "rv-ai-test-tools",
|
||||||
|
event = eventName,
|
||||||
|
timestamp_ms = os.time() * 1000,
|
||||||
|
payload = payload or {},
|
||||||
|
}
|
||||||
|
|
||||||
|
print(("[AI_TEST_TELEMETRY] %s"):format(json.encode(event)))
|
||||||
|
end
|
||||||
|
|
||||||
|
AddEventHandler("onResourceStart", function(resourceName)
|
||||||
|
if resourceName == GetCurrentResourceName() then
|
||||||
|
emitTelemetry("resource_started", {
|
||||||
|
resource_state = GetResourceState(resourceName),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
RegisterNetEvent("rv-ai-test-tools:server:clientState", function(payload)
|
||||||
|
local sourceId = source
|
||||||
|
local now = GetGameTimer()
|
||||||
|
local previous = lastReportAt[sourceId] or 0
|
||||||
|
|
||||||
|
if now - previous < Config.MinimumReportIntervalMs then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
lastReportAt[sourceId] = now
|
||||||
|
payload = type(payload) == "table" and payload or {}
|
||||||
|
|
||||||
|
emitTelemetry("client_state", {
|
||||||
|
client_id = sourceId,
|
||||||
|
reason = tostring(payload.reason or "unknown"):sub(1, 80),
|
||||||
|
resource_state = tostring(payload.resource_state or "unknown"):sub(1, 40),
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
|
||||||
|
AddEventHandler("playerDropped", function()
|
||||||
|
lastReportAt[source] = nil
|
||||||
|
end)
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
Config = {}
|
||||||
|
|
||||||
|
-- This resource is intentionally limited to the local development server.
|
||||||
|
-- It emits only technical state; do not add player PII, credentials or raw F8 logs.
|
||||||
|
Config.ProtocolVersion = "1.0"
|
||||||
|
Config.MinimumReportIntervalMs = 2000
|
||||||
Reference in New Issue
Block a user