Integration with your server's scripts
A script that heals, teleports, makes someone invisible or spawns vehicles does, from the game's point of view, the same thing as a cheat. This page shows how the script tells the Shield that the action is its own.
The rule
The server is what allows an action. Every export on this page is called on the server side of your script.
- On the server, the Shield knows for sure which resource made the call. It cannot be faked.
- The client allows nothing. A cheat runs on the client and could call the same notice.
That is why there is no allow export on the client. If your action happens on the client, the path is: the client asks the server, the server checks whether the player is allowed, tells the Shield, and only then tells the client to run it.
-- server.lua of your script
RegisterNetEvent("hospital:tratar", function()
local src = source
if not estaNoHospital(src) then return end -- 1. check that the player is allowed
exports['mengazo-shield']:notifyAction(src, "heal") -- 2. tell the Shield
TriggerClientEvent("hospital:aplicarCura", src) -- 3. tell the client to run it
end)The check in step 1 is yours. An event that tells the Shield without checking anything allows the action for anyone who triggers the event.
What already works without code
With the companion installed in the resources (the Shield installs it on its own, see Installation), the Shield already recognizes:
- Actions done on the script's server side:
SetEntityCoords,SetEntityHealth,SetPedArmour,GiveWeaponToPed,RemoveWeaponFromPed,RemoveAllPedWeapons,FreezeEntityPositionand instance changes (SetPlayerRoutingBucket). - Teleports with the coordinates in the event: the server sends
TriggerClientEvent(or a vRP Tunnel) with avector3orx, y, z. Arriving near that point is not suspicious. - Known heal, armour and speed names sent by the server:
setHealth,revive,setArmour,setRunSpeedand similar. Your server's own names go inBridge.pushKinds(see Configuration). - Respawning after going down and entering an instance (house, prison, event).
- Heavily used teleport points: a destination where many players arrive becomes a known point.
So, before writing code, see what is left:
shield_compatThe command lists the resources whose client actions did not come from the server. Those are the ones that need one of the exports below.
Quick guide
| The script... | Use |
|---|---|
| Turns on godmode, invisibility, spectate, noclip, freecam | notifyAction and clearAction |
| Heals, gives armour, repairs a vehicle, changes speed | notifyAction |
| Teleports to a known place | notifyTeleportTo |
| Changes the player's ped | notifyPedChange or allowPed |
| Spawns vehicles, props or peds from the client | authorizeSpawn |
| Uses a blacklisted model in an event | allowModel |
| Gives a weapon, or allows a banned weapon for someone | allowWeapon and giveWeapon |
| Shows blips on other players | allowBlips |
| Has its own scene (character selector, minigame) | notifyContext |
| Calls an event many times per second | Event limit |
| Wants to ban or record the screen through the Shield | Ban, video and ban event |
Actions: notifyAction and clearAction
exports['mengazo-shield']:notifyAction(src, tipo, tempoMs, valor)
exports['mengazo-shield']:clearAction(src, tipo)| Argument | What it is |
|---|---|
src | the player's source (number) |
tipo | one of the types in the tables below |
tempoMs | optional; how long it lasts, in milliseconds. Capped at 30 seconds |
valor | optional; only for armour, heal and movemod |
A type that is not in the tables is ignored.
States that turn on and off
notifyAction turns it on. clearAction turns it off. Without tempoMs, the state lasts until clearAction, until the player leaves or until your script stops.
| Type | What for |
|---|---|
god | Invincible |
invisible | Invisible |
spectate | Watching another player |
noclip | Flying without collision |
freecam | Free camera |
freeze | Frozen in place |
nightvision | Night vision |
thermal | Thermal vision |
downed | Down, waiting for help |
cuffed | Handcuffed |
-- staff noclip command
local emNoclip = {}
RegisterCommand("nc", function(source)
if not ehStaff(source) then return end
emNoclip[source] = not emNoclip[source]
if emNoclip[source] then
exports['mengazo-shield']:notifyAction(source, "noclip")
else
exports['mengazo-shield']:clearAction(source, "noclip")
end
TriggerClientEvent("staff:noclip", source, emNoclip[source])
end)
AddEventHandler("playerDropped", function() emNoclip[source] = nil end)Without this notice, the command's noclip is treated as a cheat: after a few seconds of flying the player goes back to the starting point.
If your script has no clear "turn off" moment, pass a duration and renew it while the state lasts:
-- renews every 20 s; if the script stops renewing, the state drops on its own
exports['mengazo-shield']:notifyAction(src, "invisible", 25000)Instant actions
They open a short window: 6 seconds by default, 30 at most. Call it right before the action happens.
| Type | What for |
|---|---|
heal | Heal, revive |
armour | Armour |
fix | Vehicle repair |
teleport | Teleport with no known destination |
movemod | On-foot speed change (drug, energy drink, skill) |
stamina | Infinite or increased stamina |
weapon | Weapon handed out |
removeweapon | Weapon removed |
changeped | Player model change |
taskmod | Carrying, cuffing, attaching the player to another |
explosion | Explosion created by the script |
instance | Instance change |
-- mechanic
exports['mengazo-shield']:notifyAction(src, "fix")
TriggerClientEvent("mecanica:consertar", src)
-- carry a player on the shoulder for up to 20 s
exports['mengazo-shield']:notifyAction(alvo, "taskmod", 20000)Actions with a value
For armour, healing and speed, say how much. The Shield accepts up to that value for longer, and anything above it is still suspicious.
exports['mengazo-shield']:notifyAction(src, "armour", nil, 100) -- armour up to 100, for 2 minutes
exports['mengazo-shield']:notifyAction(src, "heal", nil, 200) -- health up to 200, for 20 seconds
exports['mengazo-shield']:notifyAction(src, "movemod", nil, 1.3) -- run up to 1.3x, for 5 minutesFull example, an armour item in the inventory:
-- server.lua
RegisterNetEvent("inventario:usarColete", function()
local src = source
if not removerItem(src, "colete", 1) then return end -- only players who have the item
exports['mengazo-shield']:notifyAction(src, "armour", nil, 100)
TriggerClientEvent("inventario:aplicarColete", src, 100)
end)-- client.lua
RegisterNetEvent("inventario:aplicarColete", function(valor)
SetPedArmour(PlayerPedId(), valor)
end)Shortcuts
They do the same as notifyAction for a single case. They take the duration in milliseconds as the second argument.
exports['mengazo-shield']:notifyHeal(src) -- 4 s by default
exports['mengazo-shield']:notifyArmour(src) -- 4 s by default
exports['mengazo-shield']:notifyPedChange(src) -- 15 s by default
exports['mengazo-shield']:notifyTeleport(src) -- 8 s by defaultTeleport
When you know the destination, pass it. The Shield only accepts it if the player arrives at that point, so a cheat cannot use the window to go somewhere else.
exports['mengazo-shield']:notifyTeleportTo(src, x, y, z, raio, tempoMs)raio: accepted distance around the destination, in meters. Default 50.tempoMs: time limit to arrive. Default 15 seconds.
-- entering an interior
RegisterNetEvent("casas:entrar", function(casaId)
local src = source
local casa = Casas[casaId]
if not casa or not temChave(src, casaId) then return end
exports['mengazo-shield']:notifyTeleportTo(src, casa.x, casa.y, casa.z, 30.0, 10000)
TriggerClientEvent("casas:irPara", src, casaId)
end)If the server already sends the coordinates inside the event, you do not need the export: the Shield reads the destination on its own.
-- this is enough
TriggerClientEvent("casas:irPara", src, vector3(casa.x, casa.y, casa.z))With no known destination (a /tpway to the map marker, for example), use the simple window. It is weaker, because it accepts any destination while it is open.
exports['mengazo-shield']:notifyTeleport(src, 8000)Ped change
-- the player is about to change model now (selector, ped shop, staff command)
exports['mengazo-shield']:notifyPedChange(src)
-- this player can always use this model (VIP ped, event mascot)
exports['mengazo-shield']:allowPed(src, "a_c_chimp")
exports['mengazo-shield']:disallowPed(src, "a_c_chimp")allowPedlasts until the player leaves or untildisallowPed. Call it again when they join.- With
allowPed, the model is allowed even if it is on the banned peds list, but only on the player's own ped. - Changing to one of the default models (
mp_m_freemode_01andmp_f_freemode_01) is never suspicious.
-- VIP ped allowed on login
AddEventHandler("meu_core:jogadorEntrou", function(src, dados)
if dados.pedVip then
exports['mengazo-shield']:allowPed(src, dados.pedVip)
end
end)Spawning vehicles, objects and peds
A vehicle, object or ped created by the script's server side already has an origin. The export is for when the client creates it (a garage that creates the car on the client, house furniture, props for a job).
exports['mengazo-shield']:authorizeSpawn(src, modelo, quantidade, tempoMs)
exports['mengazo-shield']:authorizeSpawnBatch(src, lista, tempoMs)| Argument | What it is |
|---|---|
src | source of the player who will create it. -1 = any client (then the model is required) |
modelo | name or hash. nil or 0 = any model |
quantidade | how many spawns the credit covers. Default 10, max 100 |
tempoMs | how long the credit is valid. Default 10 seconds, max 30 |
Both return true when the credit was accepted. notifySpawn is another name for authorizeSpawn.
-- garage: the player's client creates the vehicle
RegisterNetEvent("garagem:retirar", function(placa)
local src = source
local veiculo = buscarVeiculo(src, placa)
if not veiculo then return end
exports['mengazo-shield']:authorizeSpawn(src, veiculo.modelo, 1, 10000)
TriggerClientEvent("garagem:criar", src, veiculo)
end)-- garage: the SERVER creates it with CreateVehicle
-- the one that actually creates it is a client near the point, not always the one who asked: use -1 and the model
exports['mengazo-shield']:authorizeSpawn(-1, veiculo.modelo, 1, 10000)
local veh = CreateVehicle(GetHashKey(veiculo.modelo), x, y, z, heading, true, true)-- furniture: several models at once
exports['mengazo-shield']:authorizeSpawnBatch(src, {
{ model = "prop_chair_01a", count = 4 },
{ model = "prop_table_03", count = 1 },
{ model = 0, count = 2 }, -- 2 of any model
}, 15000)The credit allows the burst of that moment. The general caps still apply: active count per player, per area and across the whole server.
Blacklisted model in an event
-- allows the model for 10 minutes; without the duration, it lasts until the Shield restarts
exports['mengazo-shield']:allowModel("stt_prop_stunt_tube_s", 600000)To allow it permanently, use Allowlist.models or Config > Allowed models in the panel.
Weapons
Giving a weapon
A weapon given by the script's server side (GiveWeaponToPed on the server) already has an origin. If your inventory hands it out from the client, register it on the server:
-- you hand it out your own way; the Shield just gets told
exports['mengazo-shield']:allowWeapon(src, "WEAPON_PISTOL")
-- or let the Shield hand it out from the server (weapon, ammo, already in hand?)
exports['mengazo-shield']:giveWeapon(src, "WEAPON_PISTOL", 250, true)
-- took the weapon away from the player
exports['mengazo-shield']:disallowWeapon(src, "WEAPON_PISTOL")
-- reload from the server; returns false if the weapon is not theirs
local ok = exports['mengazo-shield']:reloadWeapon(src, "WEAPON_PISTOL", 60)
if not ok then devolverMunicao(src) endIt takes the weapon name or hash. The registration lasts until the player leaves.
Banned weapon allowed for one player
Weapons in Blacklists.playerWeapons are removed from any player's hand. To allow one of them for someone:
-- minigun allowed for the event
exports['mengazo-shield']:allowWeapon(src, "WEAPON_MINIGUN")
-- end of the event
exports['mengazo-shield']:disallowWeapon(src, "WEAPON_MINIGUN")Addon weapon or changed damage
This is not a case for an export. The Shield needs to know the weapon's base damage on your server:
- In the panel: Config > Base damage per weapon.
- Or in the file:
Allowlist.overrides.weaponDamage(see Configuration).
Do not use notifyAction(src, "weapon") to deal with a weapon that is too strong. That opens an exemption window and hides a real damage multiplier.
Blips on players
Seeing a blip on another player is how map ESP works. If your script does this on purpose (gang radar, police GPS), there are three ways:
-- 1. through the script: this player can see blips
exports['mengazo-shield']:allowBlips(src) -- until they leave, or until disallowBlips
exports['mengazo-shield']:allowBlips(src, 600000) -- for 10 minutes
exports['mengazo-shield']:disallowBlips(src)# 2. through server.cfg: a whole group
add_ace group.police mengazo.shield.bypass.blips allow-- 3. by sprite: in config/allowlist.lua (or Config > Server blip sprites)
blipSprites = { 9, 225 },-- example: GPS only for on-duty police
RegisterNetEvent("policia:servico", function(entrando)
local src = source
if not ehPolicial(src) then return end
if entrando then
exports['mengazo-shield']:allowBlips(src)
else
exports['mengazo-shield']:disallowBlips(src)
end
end)Custom scenes and states: notifyContext
For a situation that touches several things at once and does not fit a single type. You say which detections are covered and for how long.
local ok = exports['mengazo-shield']:notifyContext(src, nome, tempoMs, deteccoes)
exports['mengazo-shield']:clearContext(src, nome)nome: a name of your choice for the situation.tempoMs: from 1 to 60 seconds. Default 15.deteccoes: list with the names of the covered detections. Required.- Only the script that opened it can close it.
-- character selector: the player is invisible, gets moved and changes ped
RegisterNetEvent("personagens:abrir", function()
local src = source
exports['mengazo-shield']:notifyContext(src, "seletor", 30000, {
"INVISIBILITY", "TELEPORT", "NOCLIP_SUSPECT", "CHANGE_PED",
})
end)
RegisterNetEvent("personagens:escolhido", function()
exports['mengazo-shield']:clearContext(source, "seletor")
end)If the scene lasts more than 60 seconds, renew the context while it is open.
Most used detection names:
| Name | Detection |
|---|---|
TELEPORT | Teleport |
NOCLIP_SUSPECT | Noclip |
MOVEMENT_SPEED | On-foot speed |
SUPER_JUMP | Super jump |
INVISIBILITY | Invisible |
GODMODE_SUSPECT | Godmode |
ILLEGAL_HEAL | Heal with no origin |
ILLEGAL_ARMOUR | Armour with no origin |
CHANGE_PED | Ped change |
FREECAM | Free camera |
SPECTATOR | Spectator |
VEHICLE_SPEED | Vehicle speed |
VEHICLE_TELEPORT | Vehicle teleport |
VEHICLE_REPAIR | Vehicle repair |
The name of each detection shows up in the Blocks records in the panel.
Events called many times
The Shield limits how many times a player can call each server event. A HUD or inventory that calls a lot can hit the limit. The call is just refused, with no punishment.
- Run
shield_gatein the console. It shows the events with refusals and the suggested adjustment. - Paste the suggestion into
Config.RemoteGate.overrides:
overrides = {
["meu_hud"] = {
["meu_hud:atualizar"] = { maxCalls = 120, burst = 30 },
},
},Even better is for the script to call less: send the state only when it changes, instead of every second.
Details in Configuration.
Official player ID
With vRP, Creative, QBCore and Qbox the Shield finds the ID on its own. On a custom framework, pass it on login and on character change:
exports['mengazo-shield']:setPlayerId(source, user_id, "Passaporte") -- the 3rd argument is how the ID is labeled
exports['mengazo-shield']:setPlayerId(source, nil) -- clears it (back to the selector)
local id = exports['mengazo-shield']:getPlayerId(source)It is only for display and filtering. The ban still applies to the player's accounts (license, steam, discord).
Ban, video and ban event
Banning through the Shield
local ok, resultado = exports['mengazo-shield']:banPlayer(source, "Dinheiro duplicado no caixa")
if ok then
print("banido, ID " .. resultado) -- the ID the player sees on screen
else
print("ban recusado: " .. resultado) -- reason for the refusal
end- It follows the same path as the automatic ban: it goes to the website, records the screen before the kick and applies to the account and to the PC.
- The reason is only shown to staff (up to 200 characters). The player only sees the ban ID.
- Staff can see which script made the ban.
| Refusal | Reason |
|---|---|
inactive | Invalid license, Shield stopped |
player_offline | The player is not on the server |
reason_required | Empty reason |
already_banned | The player is already being kicked with a ban |
no_identifiers | The player has no identifiable account |
rate_limited | More than 20 bans from the same script in 1 minute |
Recording the player's screen
-- 10 s before the request and 5 s after
exports['mengazo-shield']:captureVideo(source, 10, 5, function(result)
if result.ok then
print(("clipe %s: %s"):format(result.id, result.url))
else
print("sem clipe: " .. result.error)
end
end, { title = "Report #42" })- There is only a "before" if recording was already on. Turn it on when the situation starts:
exports['mengazo-shield']:startReplay(source) -- starts keeping the last few seconds
exports['mengazo-shield']:stopReplay(source)- Before: up to 12 seconds. After: up to 15 seconds.
- With no destination, the video goes to the player's profile on the website. To send it to a Discord channel, pass
webhookin the last argument:{ title = "Report #42", webhook = "https://discord.com/api/webhooks/..." }. - Limits: 1 clip at a time per player, 3 per minute per player, 10 per minute per script.
Knowing when someone is banned
AddEventHandler("mengazo_shield:playerBanned", function(source, reason, data)
if GetInvokingResource() ~= "mengazo-shield" then return end -- only the Shield triggers it
-- source: the player, still online, or nil if they are not on the server
-- data.banId, data.origin, data.name, data.frameworkId, data.identifiers
if source then
registrarNoMeuLog(data.frameworkId, reason, data.banId)
end
end)- Use
AddEventHandler. NeverRegisterNetEventon this name: it would become an event the client can trigger. - Use the first argument, not the global
source. - It fires once per ban, before the kick. There is time to read the player's data from your framework.
data.originsays where it came from:automatic,staff,script,site,aarorhwid.
How to check
- Do the action with an account without bypass. A staff account in bypass tests nothing.
- Run
shield_watch <id>in the console to follow the player live. - Look at Blocks in the panel. Nothing new: the integration worked.
- If a record showed up, open the evidence. The
claimedByfield shows which script did the action from the client without telling the server. shield_compatshows the summary per resource.
Common mistakes
- Calling the export on the client. It does not exist. Call it on the server.
- Telling the Shield after the action. The window has to be open when the action happens. Tell it before you tell the client to run it.
- Telling the Shield without checking. An event that allows the action without checking permission allows it for the cheat too.
- Forgetting
clearAction. The player keeps the state allowed until they leave. - A big window "just in case". The bigger the window, the more time a cheat has to take advantage of it. Use the time the action takes.
- Putting the script in trusted resources to avoid integrating. It works, but it removes protection from everything that goes through that script.
