Aller au guide

Documentation 9.6.24

Intégration serveur

Appelez les exports depuis du code serveur fiable. Le client ne choisit pas ses exceptions, privilèges ou récompenses.

Exemple en lecture seule#

L’exemple consulte le statut administrateur sans donner de droits. Vérifiez export et identifiants dans le paquet installé.

local playerId = 12
local isAdmin = exports['tosun-ac']:isAdmin(playerId)

Valider avant une exception#

Vérifiez session, joueur, position, droits et durée côté serveur. N’exposez jamais une exemption via RegisterNetEvent sans validation. Consultez le guide de sécurité Cfx.

Lire le guide officiel Cfx

Avis de téléportation#

Chaque script serveur qui déplace un joueur (maison, garage, prison, hôpital, métier) doit appeler MarkTeleport juste avant la téléportation. Aucune liste de confiance n’est nécessaire et seuls les contrôles de mouvement et de visibilité sont brièvement assouplis ; les protections des armes, de l’argent et contre l’injection restent actives. Une fois que tous les scripts de téléportation envoient cet avis, vous pouvez passer la sanction de téléportation v16 à kick dans les paramètres de l’anticheat.

exports['tosun-ac']:MarkTeleport(source, 8000)
SetEntityCoords(GetPlayerPed(source), x, y, z)

Ressources de confiance#

Les exports qui exemptent des joueurs, accordent des droits ou lancent des actions de masse (SetExempt, addAdmin, whitelistPlayer, etc.) n’acceptent que les ressources de confiance. Un appel refusé est affiché une fois dans la console avec la ligne à ajouter. Gardez la liste dans server.cfg afin que les mises à jour de l’anticheat ne l’écrasent pas. La commande console tosunac_integration affiche la liste de confiance et les derniers appels refusés.

set tosun_ac_trusted_resources "my-housing,my-clothing"

Armes données hors inventaire#

Les scripts qui donnent des armes sans les ajouter à l’inventaire, comme les arènes, le paintball ou les menus, doivent appeler AllowWeapon au moment de donner l’arme. Sinon, le contrôle arme et inventaire de 9.4.0 l’enregistre comme une arme générée. Indiquez un nom d’arme ou un astérisque pour toutes les armes ; la durée maximale est d’une heure. Ajoutez à extraWeapons dans la configuration les armes addon que l’anticheat ne connaît pas.

exports['tosun-ac']:AllowWeapon(source, "WEAPON_PISTOL", 600000)

Conserver l’autorité serveur#

Utilisez TOSUN-AC-EXPORTS.md du paquet. Les noms respectent la casse. Les exemptions utilisent des millisecondes; AddWhitelist et WhitelistArea utilisent des secondes. Démarrez tosun-ac avant ses dépendants ; gérez l’arrêt sans ignorer la protection. Un succès ne valide pas vos règles métier.

SetExempt et AllowWeapon exigent une ressource serveur de confiance. Ajoutez des scripts relus et conservez les entrées existantes. tosunac_integration affiche les refus. Couper l’application de la liste laisse passer les appels en audit ; ce n’est pas une solution permanente.

set tosun_ac_trusted_resources "my-clothing,my-arena"

# Console serveur :
tosunac_integration

Signaler juste avant le téléport#

Validez joueur, destination serveur, droit et activité. Appelez MarkTeleport immédiatement avant le déplacement. src et destination viennent du flux serveur validé, pas de paramètres libres du client. Ce fragment n’est pas un événement réseau complet.

Aucune liste requise. Assouplit brièvement mouvement et visibilité/godmode/caméra associés ; armes, argent, abus d’événements et injection restent actifs. Avec les réglages par défaut, pour les ressources hors liste de confiance : 15 secondes par appel, 180 par joueur sur dix minutes. Les extensions consomment le budget ; pas d’appel chaque tick.

-- Dans un flux serveur déjà validé :
local ok = exports["tosun-ac"]:MarkTeleport(src, 8000, "house_enter")
if ok then
    SetEntityCoords(GetPlayerPed(src), destination.x, destination.y, destination.z)
end

Autoriser une arme précise#

Pour une arène sans objet inventaire, validez la partie serveur et appelez AllowWeapon depuis la ressource de confiance. Préférez une arme et la durée nécessaire. Seuls possession et chemin de dégâts concernés sont assouplis.

Maximum une heure ; évitez l’astérisque sans besoin de toutes les armes. SetExempt est complet, trusted, limité à cinq minutes. BypassDetection ignore detectionKey : exemption complète jusqu’à une minute, pas ciblée.

Ne réutilisez pas le source temporaire d’un joueur déconnecté pour une récompense ultérieure. Vérifiez la session au moment de l’action. Une ressource de confiance doit toujours valider droits et cible.

  • Action autorisée fonctionne, permission expire.
  • Le client ne choisit ni autre joueur, ni temps, arme ou destination.
  • Appel non trusted renvoie false et avertissement.
  • Après redémarrage, vérifier état et actions normales.
-- my-arena : ressource de confiance, session validée
local allowed = exports["tosun-ac"]:AllowWeapon(src, "WEAPON_PISTOL", 60000)
-- Donner l’arme seulement dans le parcours arène validé.

Terminer les exemptions avec la bonne API serveur#

SetExempt serveur reçoit src, millisecondes et motif ; côté client, state, millisecondes et motif. Ces signatures ne sont pas interchangeables. Une exemption client n’accorde pas d’autorité serveur. Dans un parcours serveur de confiance, SetPlayerExempt avec state false retire l’exemption temporaire du joueur. Coordonnez les activités simultanées : ce statut concerne le joueur entier, sans jeton indépendant par ressource. Le retirer peut interrompre l’exemption d’une autre activité. Une exception du personnel ou du panneau peut malgré tout maintenir IsExemptFromPunish à vrai. Préférez MarkTeleport ou AllowWeapon si leur portée suffit.

  1. Terminez ou annulez l’activité autorisée avec un joueur courant validé, puis retirez l’exemption devenue inutile.
  2. Testez annulation, déconnexion et fin normale ; ne prolongez pas continuellement une exemption complète dans une boucle.
  3. Vérifiez avec un joueur ordinaire si une protection restante vient du personnel, de la whitelist du panneau ou d’une autre activité.
-- Trusted server resource; src belongs to an authorised workflow.
-- Clear the temporary exemption when that workflow finishes or is cancelled.
local cleared = exports["tosun-ac"]:SetPlayerExempt(src, false, 0, "menu_finished")

Utiliser les auxiliaires avec une politique explicite#

Ajoutez les auxiliaires du pont au manifeste de votre ressource ; ils ne remplacent pas les permissions. TosunAC.IsAvailable vérifie que AC est démarré ; TosunAC.IsTrusted vérifie la confiance de l’appelant. PlayerExempt retourne ok et mode : full est une exemption complète de confiance, soft une tolérance limitée de mouvement et visibilité. Un résultat vrai ne signifie pas immunité complète. Si une activité nécessite full, décidez comment la refuser ou l’arrêter lorsqu’elle obtient seulement soft, au lieu de continuer sous une autre portée. PlayerExemptOff retire l’exemption complète temporaire par l’API serveur.

  1. Chargez l’auxiliaire serveur avant le script utilisant TosunAC et préservez les autres dépendances du manifeste.
  2. Examinez ok et mode au début ; journalisez uniquement ressource, motif et résultat non secret.
  3. Gérez explicitement AC arrêté ou appel refusé ; vérifiez ordre de démarrage ou confiance avant de réessayer.
-- Add these lines to your own resource manifest:
client_script "@tosun-ac/bridge/tosun_ac_client.lua"
server_script "@tosun-ac/bridge/tosun_ac_server.lua"

Utiliser les lectures pour diagnostiquer, pas juger#

GetStatus fournit un bref résumé avec framework configuré et joueurs en ligne, pas un audit de toutes les intégrations. GetIntegrationStatus décrit la confiance de la ressource appelante, pas tous les scripts. IsMovementExempt et IsExemptFromPunish répondent à des questions différentes. GetDetections garde un nom historique : il lit les bans du joueur dans ts_anticheat, pas toutes les détections récentes. Un résultat vide ne certifie pas un joueur sain. Effectuez les lectures de base et recherches larges à la demande, pas chaque tick. Utilisez les objets selon leur fonction documentée sans ajouter identifiants ou données personnelles inutiles à un débogage public.

  1. Notez ressource appelante et vérification exacte de statut ou exemption consultée lors du diagnostic.
  2. Comparez portée attendue et résultat du parcours avant de changer des sanctions.
  3. Relisez TOSUN-AC-EXPORTS.md installé après mise à jour, surtout anciens alias et ordre des arguments serveur/client.

Lier un déplacement différé à la connexion et à la resource#

Quand entrer dans une maison demande une courte attente, mémoriser le numéro source du joueur ne suffit pas. Une nouvelle connexion peut réutiliser ce numéro après son départ. Le fragment server.lua est une fonction locale destinée à un parcours serveur déjà autorisé, pas un événement réseau accessible au client. La destination doit avoir été validée côté serveur. Un objet Lua unique dans pending associe le déplacement différé à ce parcours. La déconnexion supprime l’entrée ; le temporisateur ne fait rien s’il ne retrouve pas le même objet. Un nouveau joueur ayant l’ancien source ne reçoit pas l’ancien déplacement.

L’exemple efface les entrées en attente lorsque tosun-ac s’arrête ou que votre resource se ferme. À la fin du délai, il vérifie de nouveau l’état de la resource, la présence du joueur et son ped. pcall capture les erreurs d’export ; le déplacement exige un retour true de MarkTeleport. Ces vérifications n’accordent ni propriété du logement, ni rôle de métier, ni autorisation de destination : validez-les avant l’appel. Le code signale uniquement le mouvement ; il ne retire pas les exemptions complètes et ne modifie pas les permissions d’autres scripts. Testez séparément déconnexion pendant l’attente, arrêt d’AC et entrée normale. Une boucle permanente parcourant tous les joueurs est inutile ; une seule attente correspond au parcours lancé.

-- server.lua: call only from an already authorised server workflow.
-- destination is a server-validated location, never raw client input.
local pending = {}

local function scheduleValidatedMove(src, destination)
    src = tonumber(src)
    if not src or not GetPlayerName(src) then return false end
    if GetResourceState("tosun-ac") ~= "started" then return false end
    local ticket = {}
    local target = {x = destination.x, y = destination.y, z = destination.z}
    pending[src] = ticket
    SetTimeout(1500, function()
        if pending[src] ~= ticket then return end
        pending[src] = nil
        if not GetPlayerName(src) then return end
        if GetResourceState("tosun-ac") ~= "started" then return end
        local ped = GetPlayerPed(src)
        if not ped or ped == 0 then return end
        local called, allowed = pcall(function()
            return exports["tosun-ac"]:MarkTeleport(src, 8000, "house_delayed_entry")
        end)
        if called and allowed == true then
            SetEntityCoords(ped, target.x, target.y, target.z)
        end
    end)
    return true -- Scheduled, not yet moved.
end

AddEventHandler("playerDropped", function() pending[source] = nil end)
AddEventHandler("onResourceStop", function(name)
    if name == GetCurrentResourceName() or name == "tosun-ac" then
        pending = {}
    end
end)

Vérifier la confiance depuis la resource qui appelle#

Après avoir modifié la liste de confiance, placez ce diagnostic dans la resource qui effectuera réellement l’appel. La commande fonctionne uniquement dans la console serveur ; les appels de joueurs sont ignorés car src n’est pas nul. Exécutez my-resource-ac-check une fois. GetIntegrationStatus renvoie le nom de la resource appelante ainsi que trusted et enforcing. Un true obtenu depuis une autre resource ne prouve donc pas que votre script de vêtements ou d’arène est approuvé. GetStatus fournit un petit résumé d’exécution, avec version et framework configuré, pas un audit de toutes les intégrations.

Même si pcall réussit, la valeur renvoyée doit être une table. Une erreur d’appel et un retour false sont deux observations différentes ; ne déclarez pas la configuration vérifiée si l’export n’a pas pu être appelé. Avec trusted=false et enforcing=true, comparez le nom appelant à la liste examinée. enforcing=false peut correspondre à un mode d’audit ; cela ne prouve pas que toutes les opérations sensibles sont correctement restreintes. La sortie ne contient que resource, version, framework et deux booléens, sans identifiants de joueurs ni clés. Ne l’exécutez pas à chaque tick. Après une mise à jour, testez séparément parcours normal et refus attendu ; le diagnostic en lecture seule ne garantit pas les permissions des exports de sanction.

-- Place in the integrating resource's server.lua.
RegisterCommand("my-resource-ac-check", function(src)
    if src ~= 0 then return end -- Server console only.
    if GetResourceState("tosun-ac") ~= "started" then
        print("[integration] tosun-ac is not started")
        return
    end
    local okTrust, trust = pcall(function()
        return exports["tosun-ac"]:GetIntegrationStatus()
    end)
    local okStatus, status = pcall(function()
        return exports["tosun-ac"]:GetStatus()
    end)
    if not okTrust or type(trust) ~= "table"
        or not okStatus or type(status) ~= "table" then
        print("[integration] status query failed")
        return
    end
    print(("[integration] resource=%s version=%s framework=%s trusted=%s enforcing=%s")
        :format(GetCurrentResourceName(), tostring(status.version),
            tostring(status.framework), tostring(trust.trusted), tostring(trust.enforcing)))
end, false)

Enregistrer des événements validés sur le serveur#

Utilisez RegisterSafeEvent dans le script serveur. Le nom doit commencer par celui de la resource appelante. Le validateur doit renvoyer exactement true après vérification du joueur, de la mission, de la position, des objets et des permissions côté serveur. La clé du client ne donne aucun droit. Consommez une mission terminée une seule fois pour éviter les récompenses en double.

Utilisez l’export client TriggerSafeServerEvent. sent confirme uniquement l’envoi, pas un paiement ou une récompense. queued_until_key attend au maximum 30 secondes; une file pleine refuse de nouveaux appels. Ne répétez pas automatiquement les opérations économiques. Réenregistrez après un redémarrage AC.

Migrez et supprimez les anciens handlers directs RegisterNetEvent. Tosun AC ne peut pas annuler ceux d’une autre resource; conserver l’action sensible dans l’ancien événement laisse un contournement. Les handlers :safe de ProtectedEvents doivent utiliser AddEventHandler uniquement côté serveur.

-- my-job/server.lua: own server-owned job state and framework adapter.
local activeJobs = {}
local function registerActions()
    if GetResourceState("tosun-ac") ~= "started" then return end
    local ok, reason = exports["tosun-ac"]:RegisterSafeEvent("my-job:finish",
        function(src)
            local job = activeJobs[src]
            return job ~= nil and job.completed == true
            -- Also verify server-owned position, role and inventory as required.
        end,
        function(src)
            local job = activeJobs[src]
            if not job then return end
            activeJobs[src] = nil -- consume before any yielding reward operation
            -- Give the server-owned reward through your validated framework adapter.
        end, {rateLimit=5, windowMs=10000, maxArgs=0})
    if not ok then print("[my-job] SafeEvent: " .. tostring(reason)) end
end
AddEventHandler("onResourceStart", function(name)
    if name == GetCurrentResourceName() or name == "tosun-ac" then registerActions() end
end)
AddEventHandler("playerDropped", function() activeJobs[source] = nil end)

-- my-job/client.lua:
local sent, state = exports["tosun-ac"]:TriggerSafeServerEvent("my-job:finish")
-- Read state; implement a separate application acknowledgement if needed.

Configurer le nom exact de la ressource appelante#

Ajoutez set tosun_ac_trusted_resources "my-housing,my-clothing" dans server.cfg en conservant les autres noms vérifiés. Utilisez le nom de ressource/dossier, pas un nom affiché, joueur ou rôle Discord. Utilisez set, pas setr, et gardez ts.EnforceExportCallerWhitelist = true. La confiance autorise les exports sensibles, sans valider propriété, inventaire, métier ou cible. Exécutez le diagnostic dans la ressource qui agit et vérifiez trusted=true et enforcing=true.

set tosun_ac_trusted_resources "my-housing,my-clothing"

# txAdmin server console:
tosunac_integration

-- In the invoking integration resource server script:
local status = exports["tosun-ac"]:GetIntegrationStatus()
print(status.resource, status.trusted, status.enforcing)

Cinq listes aux objectifs distincts#

La liste de ressources fiables autorise les exports serveur sensibles. La whitelist joueur protège un joueur. La whitelist de faux triggers désactive un piège, sans autoriser le vrai événement. ts.ProtectedEvents est l’ancien transport à clé; la configuration fournie contient test:event. La baseline mémorise les fichiers examinés pour l’intégrité. Ajouter une entrée ne modifie pas les autres listes. Ne copiez pas tous les événements du framework dans ProtectedEvents ou dans les pièges.

Catalogue complet des exports serveur du paquet#

Les noms et déclarations d’arguments sont générés depuis l’inventaire réel des sources serveur. C’est une référence, pas un script à exécuter dans l’ordre. Respectez la casse et le côté serveur/client. Diagnostics, scans et transport internes sont inclus pour ne pas confondre un nom avec une API métier sécurisée. Vérifiez le contrat et les retours avant une modification; connaître un nom ne donne aucun droit.

-- tosun-ac / server
-- AddWhitelist(target, durationSec)
-- AllowWeapon(src, weapon, ms)
-- BanPlayerExt(playerId, reason)
-- BypassDetection(playerId, detectionKey, durationMs)
-- ClearArea(playerId, areaName)
-- ForensicLinksOf(license)
-- GetCloudThreatScore(src)
-- GetDetections(playerId, limit)
-- GetIntegrationStatus()
-- GetNearbyPlayers(playerId, radius)
-- GetPlayerInfo(playerId)
-- GetPlayerShieldData(src)
-- GetServerAuthorityStatus()
-- GetStatus()
-- IsExemptFromPunish(src)
-- IsInArea(playerId, areaName)
-- IsMovementExempt(src)
-- IsPlayerProtected(playerId)
-- IsWhitelisted(playerId)
-- KickPlayer(playerId, reason)
-- MarkTeleport(src, ms, reason)
-- NoteCloudViolation(src, reason, punishment)
-- OpenScanCache(sealed)
-- PauseAllDetections(durationMs)
-- PausePlayerDetections(playerId, durationMs)
-- RateLimit(src, key, max, windowMs)
-- RegisterSafeEvent(eventName, validator, handler, options)
-- RemoveWhitelist(target)
-- RequestShieldScreenshot(src)
-- ScanPolicyFingerprint(moduleFile, policy)
-- ScanResourceSnapshot(name, expected, callback)
-- SealScanCache(raw)
-- SetExempt(playerId, durationMs, reason)
-- SetPlayerExempt(playerId, state, durationMs, reason)
-- WhitelistArea(playerId, areaName, durationSec)
-- acV2Challenge(build, license, fp, version)
-- acV2Fingerprint()
-- acV2Integrity(raw)
-- acV2VerifyResponse(raw, build, license, fp, version, nonce, httpCode)
-- addAdmin(playerId)
-- addCheatSignature(pattern, signatureName, severity)
-- addSignatureEscrowSkip(resourceName, note)
-- addSignatureException(resourceName, filePath, signatureName, note)
-- applyTimeWithFramework(h, m)
-- applyWeatherWithFramework(weather)
-- approveResource(resourceName, approvedBy)
-- ban(playerId, reason)
-- batchDetection(playerName, license, steam, discord, ip, dtype, reason, punishment, banID, screenshot, configKey)
-- batchLog(message, playerId, playerName)
-- batchWebhook(url, payload)
-- blockResource(resourceName, reason)
-- centralHandshake()
-- centralPoll()
-- centralStatus()
-- checkIpReputation(ip)
-- cipherHasSession(src)
-- cipherIssueKey(src)
-- cipherVerify(src, payload, signature)
-- clearInventory(src)
-- crashGuardInspect(v)
-- crashGuardReject(src, p)
-- emergencyLockdown(reason)
-- fakeTriggerTrap(eventName, typ)
-- fakeTriggerWhitelist(eventName)
-- freezePlayer(src, freeze)
-- getAdminType(playerId)
-- getBanInfo(banID)
-- getBans(limit, offset)
-- getBaseline()
-- getBatchStats()
-- getCleanupStats()
-- getConfig(configType)
-- getInfectedFiles()
-- getOnlinePlayers()
-- getPlayerLocale(src)
-- getResources()
-- getRuntimeStats()
-- getSourceKey()
-- getStats()
-- getSuspicious()
-- giveWeapon(src, weapon, ammo)
-- healAll()
-- invalidateSignatureCache()
-- isAdmin(playerId)
-- isAdminMenuAllowed(playerId)
-- isPlayerFrozen(src)
-- isPlayerMuted(src)
-- isQuarantined(src)
-- isStaffPlayer(playerId)
-- issueEventKey(src)
-- licenseStatus()
-- lockdownStatus()
-- massFreeze(state)
-- mutePlayer(src, durationSec, reason, actor)
-- offlineBan(data, reason)
-- offlineBanByLicense(...)
-- phoneNotify(targetSrc, title, body, opts)
-- phoneNotifyAdmins(title, body, opts)
-- punish(playerId, reason, image, config, punish)
-- quarantine(src, reason, sec)
-- quarantineList()
-- refreshPanelPermissions()
-- refreshPanelWhitelist()
-- releaseQuarantine(src)
-- reloadSignatureExceptions()
-- reloadSignatureScanCaches()
-- removeAdmin(playerId)
-- removeSignatureEscrowSkip(idOrName)
-- removeSignatureException(id)
-- removeWhitelist(playerId)
-- reportInfection(resource, file, sigs, severity, callback)
-- rescanResources()
-- runCleanup()
-- scanAllResources()
-- scanSingleResource(name)
-- screenCapture(src, requestedBy)
-- setLockdown(state, reason)
-- setPlayerArmor(src, armor)
-- setPlayerHealth(src, hp)
-- setPlayerLocale(src, lang)
-- setSpeedLimit(kmh)
-- slayPlayer(src)
-- spectatePlayer(adminSrc, targetSrc)
-- stripWeapons(src)
-- translate(key, ...)
-- translateForPlayer(src, key, ...)
-- tsAutoSetup()
-- tsBackdoorScanStatus()
-- tsLicenseRecheck()
-- tsScanBackdoors(callback)
-- tsScanEvents()
-- tsSignatureScanStatus()
-- unban(banID)
-- unmutePlayer(src)
-- v6ScreenWatchLatest(serverId)
-- v6ScreenWatchPoll(rid)
-- v6ScreenWatchRequest(serverId, mode, requestedBy, panelUrl, forceBase64)
-- v9StreamHasSession(serverId)
-- warnPlayer(src, reason, actor)
-- webBridgeApplyInventory(src, action, itemName, count, slot)
-- webBridgeApplyMoney(src, moneyType, amount, action)
-- webBridgeFindByCitizen(cid)
-- webBridgeFindByLicense(license)
-- webBridgeGrantAdmin(src)
-- webBridgeRevokeAdmin(src)
-- whitelistPlayer(playerId, duration)

-- tosun-ac-guardian / server
-- guardianAlive()
-- guardianHold(reason,seconds)

-- tosun_render / server
-- GetStatus()

Exports client et délai local limité#

SetExempt client prend état, millisecondes et motif; côté serveur, source joueur, millisecondes et motif. PauseDetections client offre le même délai limité pour apparence, mouvement et caméra, sans pause universelle. Les appels locaux partagent 240 secondes d’extension sur dix minutes et jusqu’à 32 motifs. IsExempt(config) demande la clé exacte; IsExempt() concerne seulement le personnel vérifié ou une exemption/pause complète fiable. Armes, événements, injection et contrôles inconnus restent actifs. Traitez false sans répétition à chaque frame.

-- tosun-ac / client
-- GetExemptions()
-- IsExempt(config)
-- IsPlayerAdmin()
-- NativeGuardThreat()
-- NativeGuardToken()
-- PauseDetections(durationMs)
-- SetExempt(state, durationMs, reason)
-- SetSpawned(state)
-- ShieldCaptureForBan(callback)
-- ShieldFlushBanVideo(callback)
-- TriggerSafeServerEvent(eventName, ...)
-- getConfig()
-- getV12Tolerance(key, default)
-- incNetRequest()
-- incScreenshotEvent()
-- shieldHook(hookType, detailJson)

Comprendre l’état privé et les retours#

TosunAcState est interne à la ressource AC; les autres ressources utilisent les exports documentés. setExempt, setPause et setMovement serveur renvoient des booléens et limitent les autorisations à cinq minutes. Une notification échouée ne valide pas une nouvelle augmentation; révocation et réduction restent enregistrées malgré false. Exemption, pause et mouvement sont indépendants. setStaff écrit seulement un miroir compatible, sans autorité admin. isExemptFromBag/isPausedFromBag lisent des autorisations privées vérifiées, pas des bags modifiables. Un succès ne prouve ni livraison à tous les clients ni pause de tous les détecteurs serveur.

-- Internal AC server API; external resources use guarded exports.
-- TosunAcState.setExempt(id, active, ms) -> boolean
-- TosunAcState.setPause(id, ms) -> boolean
-- TosunAcState.setMovement(id, ms) -> boolean
-- TosunAcState.remaining(id, kind) -> remaining milliseconds
-- TosunAcState.setStaff(id, staff) -> compatibility mirror only
-- AddWhitelist(target, durationSec): seconds
-- WhitelistArea(playerId, areaName, durationSec): seconds
-- IsInArea: named record lookup, not a coordinate/permission check
-- WhitelistArea grants broad client relief, not one chosen detector.
-- BypassDetection: detectionKey is ignored; full exemption, <=60000ms
-- Client: IsExempt("ts.antiFreeCam") -> scoped camera grace
-- Client: IsExempt() -> verified staff/full/pause only

Les noms d’événements ne sont pas des autorisations#

Ce catalogue des sources liste les événements littéraux du protocole AC par côté d’enregistrement. Les noms calculés et événements de vos propres ressources peuvent manquer. Ne rejouez pas manuellement les événements internes de clé, sanction, configuration ou menu. Découvrir un nom et sa direction ne valide pas propriété ou récompense. Utilisez RegisterSafeEvent avec validation pour les actions sensibles. Le panneau et ac_protected_events alimentent les pièges/honeypots, pas des validateurs; gardez EventScanner.autoProtect=false à l’installation.

-- tosun-ac/client/AddEventHandler
-- CEventShockingGunshotFired
-- baseevents:onPlayerDied
-- baseevents:onPlayerKilled
-- esx:onPlayerDeath
-- esx_ambulancejob:revive
-- esx_basicneeds:onRevive
-- gameEventTriggered
-- hospital:client:Revive
-- hospital:client:SetDeathState
-- hospital:client:SetLaststand
-- hospital:client:isDead
-- onClientResourceStart
-- onClientResourceStop
-- playerSpawned
-- qb-ambulancejob:client:RevivePlayer
-- qb-medical:client:OnDeath
-- qb-medical:client:OnRevive
-- tosun-ac:nui:pushToolState
-- tosun-ac:uploadTokenUpdated
-- ts_anticheat:adminStateChanged
-- ts_anticheat:adminStatus
-- ts_anticheat:bridge:capture
-- ts_anticheat:bridge:clearInventory
-- ts_anticheat:bridge:freeze
-- ts_anticheat:bridge:giveWeapon
-- ts_anticheat:bridge:heal
-- ts_anticheat:bridge:mute
-- ts_anticheat:bridge:revive
-- ts_anticheat:bridge:setArmor
-- ts_anticheat:bridge:setHealth
-- ts_anticheat:bridge:slay
-- ts_anticheat:bridge:speedLimit
-- ts_anticheat:bridge:stripWeapons
-- ts_anticheat:bridge:teleport
-- ts_anticheat:bridge:time
-- ts_anticheat:bridge:warning
-- ts_anticheat:bridge:weather
-- ts_anticheat:checkTaze
-- ts_anticheat:cipher:assigned
-- ts_anticheat:cipher:request_refresh
-- ts_anticheat:clearDone
-- ts_anticheat:configUpdated
-- ts_anticheat:detectclient
-- ts_anticheat:internal:receiveKey
-- ts_anticheat:internal:trapsChanged
-- ts_anticheat:isAdmin
-- ts_anticheat:joinBundle
-- ts_anticheat:liveSSRequest
-- ts_anticheat:newDetection
-- ts_anticheat:openAdminMenu
-- ts_anticheat:openAdminMenuAuthorized
-- ts_anticheat:panelBroadcast
-- ts_anticheat:panelHeal
-- ts_anticheat:panelRevive
-- ts_anticheat:panelTime
-- ts_anticheat:panelWeather
-- ts_anticheat:promptOpenMenu
-- ts_anticheat:receiveKey
-- ts_anticheat:receiveLiveSS
-- ts_anticheat:receiveLiveVideo
-- ts_anticheat:receivePlayerCount
-- ts_anticheat:receiveScreenshot
-- ts_anticheat:requestCoords
-- ts_anticheat:resourceGuardSync
-- ts_anticheat:shield:requestScreenshot
-- ts_anticheat:shield:uploadConfig
-- ts_anticheat:startVideoLiveStream
-- ts_anticheat:startVideoLiveWeb
-- ts_anticheat:startVideoRecording
-- ts_anticheat:stopVideoLiveStream
-- ts_anticheat:stopVideoLiveWeb
-- ts_anticheat:stopVideoRecording
-- ts_anticheat:syncBanList
-- ts_anticheat:syncConfig
-- ts_anticheat:syncIdentifiers
-- ts_anticheat:syncLogs
-- ts_anticheat:syncPlayers
-- ts_anticheat:takeScreenshot
-- ts_anticheat:unbanDone
-- ts_anticheat:webPanelScreenshot

-- tosun-ac/client/RegisterNUICallback
-- Armour
-- DeleteAll
-- DeleteObjects
-- DeletePeds
-- DeleteVehicles
-- GetPlayerIdentifiers
-- Health
-- addLog
-- armourPlayer
-- banPlayer
-- bringAll
-- bringPlayer
-- cancelAnimation
-- clearNearbyObjects
-- clearNearbyPeds
-- clearNearbyVehicles
-- devtoolsdetected
-- exit
-- freezeAll
-- freezePlayerToggle
-- getBans
-- getLogs
-- getPlayerCount
-- getPlayers
-- giveWeaponPlayer
-- healAll
-- healPlayer
-- isInVehicle
-- kickPlayer
-- liveWatchStart
-- liveWatchStop
-- nuiDependencyMissing
-- nuiWatermark
-- repair
-- returnOCRResult
-- reviveAll
-- revivePlayer
-- screenshotPlayer
-- selfRevive
-- setHealthPlayer
-- setTime
-- setWeather
-- shield_devtools
-- shield_heartbeat
-- shield_heartbeat_fail
-- shield_screenshot
-- shield_tokens
-- shield_video_final
-- shield_video_segment
-- slayPlayer
-- spawnVehicle
-- spectatePlayer
-- stopSpectate
-- stripWeaponsPlayer
-- toggleESP
-- toggleFreecam
-- toggleGodmode
-- toggleInvisible
-- toggleNoclip
-- tosunRenderResult
-- tpToPlayer
-- unbanPlayer
-- verifyModel
-- videoLiveSegmentResult
-- videoRecordingResult
-- videoRecordingStartResult
-- warnPlayerNUI

-- tosun-ac/client/RegisterNetEvent
-- QBCore:Client:OnPlayerLoaded
-- QBCore:Client:OnPlayerUnload
-- esx:onPlayerDeath
-- esx:onPlayerLogout
-- esx:playerLoaded
-- esx_ambulancejob:revive
-- esx_basicneeds:onRevive
-- hospital:client:Revive
-- hospital:client:SetDeathState
-- hospital:client:SetLaststand
-- hospital:client:isDead
-- qb-ambulancejob:client:RevivePlayer
-- qb-medical:client:OnDeath
-- qb-medical:client:OnRevive
-- qbx_core:client:playerLoggedIn
-- qbx_multicharacter:client:chooseChar
-- ts_anticheat:adminStateChanged
-- ts_anticheat:adminStatus
-- ts_anticheat:bridge:capture
-- ts_anticheat:bridge:clearInventory
-- ts_anticheat:bridge:freeze
-- ts_anticheat:bridge:giveWeapon
-- ts_anticheat:bridge:heal
-- ts_anticheat:bridge:mute
-- ts_anticheat:bridge:revive
-- ts_anticheat:bridge:setArmor
-- ts_anticheat:bridge:setHealth
-- ts_anticheat:bridge:slay
-- ts_anticheat:bridge:speedLimit
-- ts_anticheat:bridge:stripWeapons
-- ts_anticheat:bridge:teleport
-- ts_anticheat:bridge:time
-- ts_anticheat:bridge:warning
-- ts_anticheat:bridge:weather
-- ts_anticheat:checkTaze
-- ts_anticheat:cipher:assigned
-- ts_anticheat:cipher:request_refresh
-- ts_anticheat:clearDone
-- ts_anticheat:detectclient
-- ts_anticheat:isAdmin
-- ts_anticheat:joinBundle
-- ts_anticheat:liveSSRequest
-- ts_anticheat:newDetection
-- ts_anticheat:openAdminMenu
-- ts_anticheat:openAdminMenuAuthorized
-- ts_anticheat:panelBroadcast
-- ts_anticheat:panelHeal
-- ts_anticheat:panelRevive
-- ts_anticheat:panelTime
-- ts_anticheat:panelWeather
-- ts_anticheat:promptOpenMenu
-- ts_anticheat:receiveEventKey
-- ts_anticheat:receiveKey
-- ts_anticheat:receiveLiveSS
-- ts_anticheat:receiveLiveVideo
-- ts_anticheat:receivePlayerCount
-- ts_anticheat:receiveScreenshot
-- ts_anticheat:requestCoords
-- ts_anticheat:resourceGuardSync
-- ts_anticheat:shield:requestScreenshot
-- ts_anticheat:shield:uploadConfig
-- ts_anticheat:startVideoLiveStream
-- ts_anticheat:startVideoLiveWeb
-- ts_anticheat:startVideoRecording
-- ts_anticheat:stopVideoLiveStream
-- ts_anticheat:stopVideoLiveWeb
-- ts_anticheat:stopVideoRecording
-- ts_anticheat:syncBanList
-- ts_anticheat:syncConfig
-- ts_anticheat:syncIdentifiers
-- ts_anticheat:syncLogs
-- ts_anticheat:syncPlayers
-- ts_anticheat:takeScreenshot
-- ts_anticheat:unbanDone
-- ts_anticheat:uploadToken
-- ts_anticheat:webPanelScreenshot

-- tosun-ac/server/AddEventHandler
-- QBCore:Server:OnPlayerLoaded
-- QBCore:Server:PlayerLoaded
-- chatMessage
-- clearPedTasksEvent
-- entityControlEvent
-- entityCreated
-- entityCreating
-- esx:playerLoaded
-- eventTriggered
-- explosionEvent
-- fireEvent
-- giveWeaponEvent
-- onResourceStart
-- onResourceStop
-- onServerResourceStart
-- playerConnecting
-- playerDropped
-- playerJoining
-- ptFxEvent
-- qbx_core:server:playerLoaded
-- rconCommand
-- removeAllWeaponsEvent
-- removeWeaponEvent
-- requestControlEvent
-- respawnPlayerPedEvent
-- startProjectileEvent
-- tosun-ac:nuiPermissionRefreshed
-- tosun-ac:panel:characterReady
-- tosun-ac:server:detection
-- tosun-ac:server:logResourceActivity
-- tosun-ac:server:nuiWatermark
-- tosun-ac:server:signedDetection
-- tosun-ac:settingsReloaded
-- ts_anticheat:GetPlayerIdentifiers
-- ts_anticheat:addAdmin_internal
-- ts_anticheat:addLog
-- ts_anticheat:adminDelEntity
-- ts_anticheat:banCommitted
-- ts_anticheat:banPlayer
-- ts_anticheat:banRelay
-- ts_anticheat:bridge:freeze
-- ts_anticheat:bringAllPlayers
-- ts_anticheat:bringPlayer
-- ts_anticheat:cipher:detection
-- ts_anticheat:cipher:request
-- ts_anticheat:clearTasks
-- ts_anticheat:client:scriptsReady
-- ts_anticheat:configUpdated
-- ts_anticheat:deleteObjects
-- ts_anticheat:deletePeds
-- ts_anticheat:deleteVehicles
-- ts_anticheat:freezeAllPlayers
-- ts_anticheat:getBanList
-- ts_anticheat:getLogs
-- ts_anticheat:getPlayerCount
-- ts_anticheat:getPlayers
-- ts_anticheat:healAllPlayers
-- ts_anticheat:internal:pushResourceGuard
-- ts_anticheat:internal:suspicious
-- ts_anticheat:kickPlayer
-- ts_anticheat:liveSSResult
-- ts_anticheat:liveWatchStart
-- ts_anticheat:liveWatchStop
-- ts_anticheat:logAdminMenu
-- ts_anticheat:newLog
-- ts_anticheat:playerBanned
-- ts_anticheat:requestAdminStatus
-- ts_anticheat:requestEventKey
-- ts_anticheat:requestKey
-- ts_anticheat:requestOpenAdminMenu
-- ts_anticheat:returnCoords
-- ts_anticheat:reviveAllPlayers
-- ts_anticheat:screenshotPlayer
-- ts_anticheat:screenshotResult
-- ts_anticheat:server:<computed suffix> [template only; not a runnable exact event]
-- ts_anticheat:server:checkIsAdmin
-- ts_anticheat:server:clientXkzuqBwmTjN7Gab4QzuN9QYZJ1WxxU
-- ts_anticheat:server:requestJoinHandshake
-- ts_anticheat:server:requestResourceGuard
-- ts_anticheat:server:requestSyncData
-- ts_anticheat:server:tazed
-- ts_anticheat:serverClear
-- ts_anticheat:setInvisible
-- ts_anticheat:setTime
-- ts_anticheat:setWeather
-- ts_anticheat:shield:ban_video_saved
-- ts_anticheat:spawnVehicle
-- ts_anticheat:targetArmour
-- ts_anticheat:targetFreeze
-- ts_anticheat:targetGiveWeapon
-- ts_anticheat:targetHeal
-- ts_anticheat:targetRevive
-- ts_anticheat:targetSetHealth
-- ts_anticheat:targetSlay
-- ts_anticheat:targetStripWeapons
-- ts_anticheat:targetWarn
-- ts_anticheat:tpToPlayer
-- ts_anticheat:unbanPlayer
-- ts_anticheat:v10:exec
-- ts_anticheat:v6:detection
-- ts_anticheat:v6:screenshotResult
-- ts_anticheat:verifyModel
-- ts_anticheat:videoResult
-- vehicleComponentControlEvent
-- weaponDamageEvent

-- tosun-ac/server/RegisterNetEvent
-- tosun-ac:panel:characterReady
-- tosun-ac:server:detection
-- tosun-ac:server:logResourceActivity
-- tosun-ac:server:nuiWatermark
-- tosun-guard:acMissing
-- tosun-guard:hello
-- tosun-guard:tick
-- tosun:nativeGuard:status
-- ts_anticheat:GetPlayerIdentifiers
-- ts_anticheat:addLog
-- ts_anticheat:adminDelEntity
-- ts_anticheat:banPlayer
-- ts_anticheat:banRelay
-- ts_anticheat:bridge:freeze
-- ts_anticheat:bringAllPlayers
-- ts_anticheat:bringPlayer
-- ts_anticheat:cipher:detection
-- ts_anticheat:cipher:request
-- ts_anticheat:client:scriptsReady
-- ts_anticheat:deleteObjects
-- ts_anticheat:deletePeds
-- ts_anticheat:deleteVehicles
-- ts_anticheat:freezeAllPlayers
-- ts_anticheat:getBanList
-- ts_anticheat:getLogs
-- ts_anticheat:getPlayerCount
-- ts_anticheat:getPlayers
-- ts_anticheat:healAllPlayers
-- ts_anticheat:kickPlayer
-- ts_anticheat:liveSSResult
-- ts_anticheat:liveWatchStart
-- ts_anticheat:liveWatchStop
-- ts_anticheat:logAdminMenu
-- ts_anticheat:requestAdminStatus
-- ts_anticheat:requestEventKey
-- ts_anticheat:requestKey
-- ts_anticheat:requestOpenAdminMenu
-- ts_anticheat:returnCoords
-- ts_anticheat:reviveAllPlayers
-- ts_anticheat:screenshotPlayer
-- ts_anticheat:screenshotResult
-- ts_anticheat:server:checkIsAdmin
-- ts_anticheat:server:clientXkzuqBwmTjN7Gab4QzuN9QYZJ1WxxU
-- ts_anticheat:server:requestJoinHandshake
-- ts_anticheat:server:requestResourceGuard
-- ts_anticheat:server:requestSyncData
-- ts_anticheat:server:tazed
-- ts_anticheat:serverClear
-- ts_anticheat:setInvisible
-- ts_anticheat:setTime
-- ts_anticheat:setWeather
-- ts_anticheat:shield:banVideo
-- ts_anticheat:shield:heartbeat_fail
-- ts_anticheat:shield:requestUploadConfig
-- ts_anticheat:shield:screenshot
-- ts_anticheat:shield:tokens
-- ts_anticheat:spawnVehicle
-- ts_anticheat:targetArmour
-- ts_anticheat:targetFreeze
-- ts_anticheat:targetGiveWeapon
-- ts_anticheat:targetHeal
-- ts_anticheat:targetRevive
-- ts_anticheat:targetSetHealth
-- ts_anticheat:targetSlay
-- ts_anticheat:targetStripWeapons
-- ts_anticheat:targetWarn
-- ts_anticheat:tpToPlayer
-- ts_anticheat:unbanPlayer
-- ts_anticheat:v10:exec
-- ts_anticheat:v6:detection
-- ts_anticheat:v6:screenshotResult
-- ts_anticheat:verifyModel
-- ts_anticheat:videoResult

-- tosun-ac/server/RegisterServerEvent
-- ts_anticheat:clearTasks

-- tosun-ac/shared/AddEventHandler
-- onClientResourceStart
-- onResourceStop
-- playerDropped
-- ts_anticheat:locale:reload
-- ts_anticheat:locale:setSelf
-- ts_anticheat:locale:sync

-- tosun-ac/shared/RegisterNetEvent
-- ts_anticheat:locale:setSelf
-- ts_anticheat:locale:sync

-- tosun-ac-guardian/server/AddEventHandler
-- onResourceStart
-- onResourceStop

-- tosun_render/server/AddEventHandler
-- onResourceStart

-- tosun-ac/client / RegisterCommand
-- stopspectate
-- tsdelaimed
-- tsfreecam
-- tsmenu
-- unspectate

-- tosun-ac/server / RegisterCommand
-- ac_cleanup
-- acfreeze
-- acping
-- acstats
-- acunfreeze
-- acwarn
-- capture
-- clearinv
-- emergency
-- giveweapon
-- massfreeze
-- mute
-- setarmor
-- sethp
-- speedlimit
-- stripweapons
-- tosunac_backdoorscan
-- tosunac_db_check
-- tosunac_db_status
-- tosunac_doctor
-- tosunac_eventscan
-- tosunac_integration
-- tosunac_license_status
-- tosunac_setup
-- ts
-- ts_adminsync
-- ts_broadcast
-- ts_capture
-- ts_clearinv
-- ts_emergency
-- ts_freeze
-- ts_giveweapon
-- ts_healall
-- ts_kickall
-- ts_lockdown
-- ts_massfreeze
-- ts_modping
-- ts_mute
-- ts_players
-- ts_revive
-- ts_setarmor
-- ts_sethp
-- ts_settime
-- ts_setweather
-- ts_slay
-- ts_speedlimit
-- ts_stripweapons
-- ts_tphere
-- ts_tpto
-- ts_unfreeze
-- ts_unmute
-- ts_v9_help
-- ts_warn
-- ts_warnings
-- unmute

-- tosun-ac/shared / RegisterCommand
-- ts_setlang

-- tosun-ac-guardian/server / RegisterCommand
-- tosunac_guardian_pause
-- tosunac_guardian_resume
-- tosunac_guardian_status

-- tosun_render/server / RegisterCommand
-- tosun_render_status

SafeEvent: redémarrage, file et erreurs#

RegisterSafeEvent exige un nom préfixé par votre ressource, un validator et un handler. Le validator renvoie exactement true après vérification de l’état serveur actuel. Retirez l’ancien handler réseau brut: AC ne peut pas annuler un handler indépendant externe. Réenregistrez après redémarrage de votre ressource ou tosun-ac. Statuts client: sent, queued_until_key, queue_full, invalid_event_or_arguments, resource_stopping. sent signifie envoi, pas reçu de récompense. La file contient au plus 32 appels pendant 30 secondes. Aucun rejeu ni succès automatique après erreur du handler. Utilisez un reçu applicatif et une action idempotente; ne répétez jamais automatiquement argent ou objets.

-- Client TriggerSafeServerEvent results:
-- true,  "sent"
-- false, "queued_until_key"
-- false, "queue_full"
-- false, "invalid_event_or_arguments"
-- false, "resource_stopping"

-- Server RegisterSafeEvent results:
-- true, "registered"
-- false + server_resource_required / use_own_resource_prefix
-- false + invalid_callbacks_or_options / already_registered / registration_capacity

-- Server log may say: application handler failed.
-- No automatic replay; implement an application receipt.

Un rapport en file n’est pas une écriture confirmée#

reportInfection(resource, file, sigs, severity[, callback]) renvoie true seulement pour une opération DB mise en file. Callback facultatif au plus une fois: success, affectedRows; succès exige un entier positif. Sans réponse du driver, aucune garantie de fin. Resource 1–190 octets lettres/chiffres/_.-, file 1–500 octets, severity 1–50 lettres/chiffres/_- (warning par défaut). sigs est un texte non vide ou liste dense 1–32 textes, valeur jointe au plus 255 octets. NUL/CR/LF sont refusés. Données invalides, driver absent/refus ou erreur synchrone: false. Ne rejouez pas automatiquement une fin incertaine.

-- A reviewed server reporting workflow; fictional non-secret labels.
-- resource: 1..190 bytes, letters/digits/underscore/dot/hyphen
-- file: 1..500 bytes; signatures joined: 1..255 bytes
-- severity: 1..50 bytes, letters/digits/underscore/hyphen (no dot)
local queued = exports["tosun-ac"]:reportInfection(
    "my-housing", "server.lua", {"reviewed_pattern"}, "warning",
    function(success, affectedRows)
        print(success and "[scan] report saved" or "[scan] report not confirmed")
    end)
-- queued=true is dispatch only; it is not the completion callback.
-- Do not automatically retry an operation with an uncertain outcome.