I am looking for a jail script, one that will send the player to a set location for a certain amount of time, then release them. I am currently trying to use one I found on pastebin but it’s not working
Make sure if you grabbed the one from the paste bin you also replace your chat resource that comes with it
I have, when I type the commands nothing happens.
Then something has been done wrong or there is an issue… Get rid of this post and post in the right format in Tech Support
Don’t post in tech support. It’s either code you’ve written which is wrong or, it’s code someone else has written that’s wrong.
If it’s your code, I suggest you post it here and we can help you debug it. If it’s someone else’s code I suggest you go and post in the original topic and ask the developer for help.
Edit: My comment is based one the comments
There is no post for the code… And the code works cause many many people have it… So there for he is looking for TECH SUPPORT to help him find the problem… Could be as simple as double checking the way it was put in… The reason I suggested that is because that’s a good start to post in the correct format to have screenshots of folders to determine where the mix up is! There is nothing wrong with the script… Nothing to “Debug”…
You need to add this…
found in resource/ system folder, locate “chat” then edit Chat_client.lua with the following.
local chatInputActive = false
local chatInputActivating = false
RegisterNetEvent(‘chatMessage’)
AddEventHandler(‘chatMessage’, function(name, color, message)
SendNUIMessage({
name = name,
color = color,
message = message
})
end)
RegisterNUICallback(‘chatResult’, function(data, cb)
chatInputActive = false
SetNuiFocus(false)
if data.message then
local id = PlayerId()
--local r, g, b = GetPlayerRgbColour(id, _i, _i, _i)
local r, g, b = 0, 0x99, 255
if(string.sub(data.message, 1, 1) == "*" and string.len(data.message) >= 2) then
TriggerServerEvent('chatCommandEntered', data.message)
else
TriggerServerEvent('chatMessageEntered', GetPlayerName(id), { r, g, b }, data.message)
end
end
cb('ok')
end)
Citizen.CreateThread(function()
SetTextChatEnabled(false)
while true do
Wait(0)
if not chatInputActive then
if IsControlPressed(0, 245) --[[ INPUT_MP_TEXT_CHAT_ALL ]] then
chatInputActive = true
chatInputActivating = true
SendNUIMessage({
meta = 'openChatBox'
})
end
end
if chatInputActivating then
if not IsControlPressed(0, 245) then
SetNuiFocus(true)
chatInputActivating = false
end
end
end
end)
client_script "clientJailer.lua"
server_script {
"serverJailer.lua"
}
My exact code. Also replaced the chat_client, which moved my chat to the right side instead of left for some reason. Still isn’t working.
And you are entering it as *jail (password) (PlayerID) (Seconds)
No brackets
Yes… The console says to use “/jail” but in the files there is “*jail”
Yeah if you havent changed it, it will use *jail… If you give me a few mins I can give you mine the way I have it set up and with a new chat resource to replace.
Alright man sounds good. Video demo: https://gyazo.com/55552108d0458d1bfc8b7c02030019b4
Would like to use normal /jail instead of *jail, can you show an example?
The only reference to the “chatCommandEntered” event I could find was at the top of “chat_server.lua”. I couldn’t find where or when this event would be fired (maybe it’s for a future update?).
Anyways, double check that the event is being fired (put some prints in there) and if it’s not (which I think will be the case) use the “chatMessage” event instead. The top of the event would look something like
AddEventHandler("chatMessage", function(source, name, message)
local cm = stringsplit(message, " ")
if (args[1] ~= "*jail") or (args[1] ~= "*unjail") or (args[1] ~= "*jailme") then -- Not a jail command
return
end
-- it's our command.. cancel the message from being sent
CancelEvent()
-- Rest of code here
end)
I am running essentialmode and es_admin.
How do I make it work with that?
You need to make sure you have
- chat
in your yml, I dont believe you do.
Then make sure you add the chat script I posted above.
You will need to use *jail (pw) (id) (sec)
you can also use just *jail (pw) (id) (without any amount of sec it will jail them automatically for 180 secs)
now if you decide to edit the * and change all the * to / I can tell you now that it will then work as /jail etc etc etc but any / commands you have will no longer work.
How do I convert it to essentialmode?
i dont know what you are looking to convert… I use essentialmode/es freeroam. I do not need to do anything
The script just isnt working for me at all and I think its because the commands through essentialmode.
@Havoc… Again… There is NOTHING wrong with the code… He has done everything right and I have double checked that… Even the chat replacement… Im pretty sure it doesn’t want to work with ES because ES is crap and will be the downfall of this project