- Command Initialization:
- When a player types
/jail [targetPlayerID and how much time in seconds]in the chat, the script is triggered. - Player Identification:
- The script identifies the player who typed the command (let’s call them the initiator).
- The script also identifies the player to be jailed using the provided
targetPlayerID. - Permission Check:
- The script checks if the initiator has permission to use the jail command (e.g., is the initiator a police officer?).
- Jail Location:
- The script has predefined coordinates for the jail location (x, y, z).
- Teleportation:
- If the initiator has the necessary permissions and the targetPlayerID is valid, the target player is teleported to the jail location.
- Notification:
- A message is sent to the target player notifying them that they have been jailed.
- If the initiator does not have permission or the player ID is invalid, an appropriate error message is shown to the initiator.
6 Likes
Please fix your vulnerable event, move the job check to the server side (or just the whole command).
1 Like
What is this…
2 Likes
Its My first script i know its kinda bad
Itse My first script i know its kinda bad And i im gonna FIX it
Kiitos on huikee!!!
1 Like
Hyvä että tykkäsit🙂
Here is a updated version to kinda fix the vulnerability, should work haven´t tested it out yet:
ESX = exports["es_extended"]:getSharedObject()
ESX.RegisterServerCallback("Jail:getjob", function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
cb(xPlayer.job.name)
end)
RegisterServerEvent("Jail:sendToJail")
AddEventHandler("Jail:sendToJail", function(player, time)
local xPlayer = ESX.GetPlayerFromId(source)
local xTarget= ESX.GetPlayerFromId(player)
if xPlayer.job.name == "police" then
if xPlayer ~= nil and xTarget ~= nil then
TriggerClientEvent("Jail:goToJail", xPlayer.source, time)
end
else
print("[JAIL SYSTEM] There is a Strange Player that bypassed the Jail System look at him: " .. xPlayer.getName() .. " !")
end
end)
1 Like
Why do you even have client side for this?
Can you help me? How can I? If the player is offline, the player can be imprisoned, and if he enters the game, he will be sent directly to prison for the specified period.
I don’t know if that’s even possible
It is, with sql
dead link