Dla programistów
Exporty i hooki
Wołaj APIAC z własnych zasobów: banuj i sprawdzaj graczy na serwerze, a anti-cheatowi mów, kiedy skrypt robi coś celowo.
Zanim zaczniesz
- Wszystko wołasz przez
exports.APIAC:nazwa(...). - Exporty serwerowe pojawiają się kilka sekund po starcie serwera, kiedy licencja zostanie sprawdzona.
sourceto zawsze ID gracza online na serwerze.
Exporty serwerowe
exports.APIAC:banPlayer(source, reason, details, days)days bierze długość bana z panelu, 0 to ban na zawsze. details to opcjonalna tabela do logów.Zwraca true, gdy gracz dostał bana
exports.APIAC:kickPlayer(source, reason, details)Zwraca true, gdy gracz został wyrzucony
exports.APIAC:unbanPlayer(banId, unbannedBy)unbannedBy to nazwa do logów.Zwraca true, gdy ban istniał
exports.APIAC:unbanAllPlayers(unbannedBy)bans.json.Zwraca liczbę zdjętych banów
exports.APIAC:getBanInfo(banId)id, name, reason, bannedBy, expiresAt (-1 znaczy nigdy) i inne.Zwraca tabelę bana albo nil
exports.APIAC:banIdentifiers({ license, identifiers, tokens, name }, reason, details, durationDays, bannedBy)0 dni to ban na zawsze.Zwraca ID bana i to, czy już istniał, albo false
exports.APIAC:unbanIdentifiers(identifiers, tokens, unbannedBy)Zwraca listę ID zdjętych banów
exports.APIAC:findBan(identifiers, tokens)Zwraca id, name, reason, bannedBy, date, expiresAt albo nil
exports.APIAC:toggleBypass(source, toggle)Zwraca true, gdy się udało
exports.APIAC:tempBypass(source, seconds)Zwraca true, gdy się udało
exports.APIAC:hasBypass(source)Zwraca true albo false
exports.APIAC:isAdmin(source)Zwraca true albo false
exports.APIAC:screenshot(source)Zwraca URL obrazka albo nil
exports.APIAC:recordClip(source)screenshot, ale zapisuje ostatnie sekundy gry. Wymaga włączonego nagrywania rozgrywki.Zwraca URL klipu albo nil
exports.APIAC:getPlayerIdentifiers(source)Zwraca listę tekstów
exports.APIAC:getPlayTime(source)nil, dopóki profil się nie wczyta.Zwraca sekundy albo nil
exports.APIAC:getThreatScore(source)nil, dopóki profil się nie wczyta.Zwraca od 0 do 100 albo nil
exports.APIAC:getPlayerTokens(source)Zwraca listę tekstów
RegisterCommand("acban", function(source, args) if source ~= 0 and not exports.APIAC:isAdmin(source) then return end local target, days = tonumber(args[1]), tonumber(args[2]) local reason = table.concat(args, " ", 3) exports.APIAC:banPlayer(target, reason, { by = GetPlayerName(source) or "Konsola" }, days)end, false)RegisterCommand("sluzba", function(source) if not IsPlayerAceAllowed(source, "group.staff") then return end exports.APIAC:toggleBypass(source, true)end, false)Eventy serwerowe
| Event | Argumenty |
|---|---|
APIAC/internal/playerBanned | source, ban: ta sama tabela, którą zwraca getBanInfo. Przy banie offline source to nil. |
APIAC/internal/playerKicked | source, reason |
APIAC/internal/playerUnbanned | ban, unbannedBy |
AddEventHandler("APIAC/internal/playerBanned", function(source, ban) if not ban?.id then return end print(ban.name .. " dostał bana za " .. ban.reason .. ", ID bana " .. ban.id)end)Hooki
Większość skryptów ich nie potrzebuje. Każdy zasób w Lua z zainstalowanym APIAC woła je sam. Wołaj hook ręcznie, gdy kod działa tam, gdzie APIAC go nie widzi: w zasobach C# i JavaScript, przy natywkach wołanych po hashu albo w zasobach z listy ignorowanych.
Wołaj hook tuż przed akcją, chyba że opis mówi inaczej.
exports.APIAC:hasTeleported()Citizen.InvokeNative(0x06843DA7060A026B, PlayerPedId(), x, y, z, false, false, false, false)Pozycja i kamera
exports.APIAC:hasTeleported()StartPlayerTeleport.exports.APIAC:hasChangedPedModel(model)SetPlayerModel, z nowym modelem.exports.APIAC:setSpectatorMode(toggle)exports.APIAC:createCam(cam)exports.APIAC:destroyCam(cam)exports.APIAC:destroyCams()DestroyAllCams.Zdrowie i obrażenia
exports.APIAC:healthRefilled()exports.APIAC:playerRevived()exports.APIAC:armourChanged()exports.APIAC:resettedStamina()exports.APIAC:isInvincible(toggle)exports.APIAC:proofsEnabled(toggle)exports.APIAC:canBeDamaged(toggle)exports.APIAC:isVisible(toggle)exports.APIAC:setCriticalHits(toggle)Broń
exports.APIAC:giveWeapon(weaponHash)exports.APIAC:removeWeapon(weaponHash)exports.APIAC:removeAllWeapons()exports.APIAC:hasAddedAmmo()exports.APIAC:setNewDamage(weaponHash, modifier)exports.APIAC:allowShootTask()Pojazdy i ruch
exports.APIAC:sprintMultiplier(multiplier)exports.APIAC:newTopSpeedModifier(value)exports.APIAC:newCheatPowerIncrease(value)exports.APIAC:newGravity(value)Ekran i sterowanie
exports.APIAC:allowTexture(textureDict)exports.APIAC:allowPlayerBlip(entity)exports.APIAC:displayInputBox()exports.APIAC:disableE2()exports.APIAC:disableCamControls()exports.APIAC:disableAllControls()Na serwerze
exports.APIAC:CreateEntity(model)