[Release-Archived] Cops FiveM

ok i check it and screen it

Anyone know how I can edit the script so that anybody can add themselves as a cop and not just admins?
(EDITED See below code)
I’ve tried things along the lines of…


TriggerEvent('es:addCommand', 'addcop', function(source, args, user) 
				TriggerEvent("es:getPlayerFromId", source, function(player)
					addCop(player.identifier)
					TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "Roger that !")
					TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "Congrats, you're now a cop !")
					TriggerClientEvent('police:nowCop', player)
				end)
end)

I think it gets stuck at this part:
(EDITED. See below code)

TriggerEvent("es:getPlayerFromId", source, function(player)
					addCop(player.identifier)

Here’s what I used to make it work
If anyone sees any errors or improvements, please let me know as I don’t know how good this method really is.

TriggerEvent('es:addCommand', 'addcop', function(source, args, user) 
				addCop(source)
				TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "Roger that!")
				TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "Congrats, you are now a cop!")
				TriggerClientEvent('police:nowCop', source)
end)

It can’t work with addCop(source) because source is just a number (net id if I remember) and it change each time you disconnect.
You have to get the identifier (ip:x.x.x.x or steam:xxxxxxxxxxxxxxx) to add cop in database

Maybe I’m wrong, please correct me if it is.

That’s what I was thinking, it’s a step closer at least but now I need to make it work with the actual identifier like you say.
Currently trying out something along the lines of:

TriggerEvent('es:addCommand', 'addcop', function(source, args, user) 
TriggerEvent("es:getPlayerFromId", source, function(user)
				local player = user.identifier
				addCop(player)

You should just modify this : addAdminCommand to this : addCommand
It should work

I did but it still requires the user to know their ID as it takes it as an argument:

/addcop [id]

I’m doing it so that the ID is included in the request and the user just needs to type /addcop to become a cop themselves. (Although I’m also changing it to /becop but that’s not really relevant)

This works fine now, thanks for pointing me away from the source error! :slight_smile:

I might post this as a little how to also after some more testing in case others want it but here’s the final code:

TriggerEvent('es:addCommand', 'becop', function(source, args, user) 
				TriggerEvent("es:getPlayerFromId", source, function(user)
				local player = user.identifier
				addCop(player)
				TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "Roger that!")
				TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "Congrats, you are now a cop!")
				TriggerClientEvent('police:nowCop', source)
				end)
end)

TriggerEvent('es:addCommand', 'nocop', function(source, args, user) 
				TriggerEvent("es:getPlayerFromId", source, function(user)
				local player = user.identifier
				remCop(player)
				TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "Roger that!")
				TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "You have been relieved of your duties!")
				TriggerClientEvent('police:noLongerCop', source)
				end)
end)
1 Like

Kyominii : Here is my error

Do you have the package ? If not, have you retry to follow all instructions ?

I don’t think that error is related to this release. I keep seeing those generally with and without the Cops script.

Hi Kyo, nothing appears NULL in my DB.

Trying with your .sql and same error.

You have added the limit column ? and not null

Really good scipt but how to get out a player has been forceenter and cuffed?

1 Like

Yes I would like to know too. Does your excavation system work? For me he does not show me the inventory of the player, just a simple message.

Hello, I am using a translator and I am using the full package on my server, I have to modify the mysql coordinates of my server jai import the font.sql And when I connect to my server no more point of recollection processing and resale is visible how to make it please? Thanks in advance: p

I have a same problem

look my f8 on a crop field

I use Complete Package

I try with a last release VK Recolt and VK inventory for test (Nope i doesn’t work for me ) ):

Can you upload your files pls Kyominii or you can pass on a ts or discord if ever ? or me

I also worried about

I do not understand what to do with this:

“Complete Package120, don’t forget to add a limitation INT NOT NULL (greater than 0) column in your items table”

IRemake : add a limitation INT NOT NULL, you probably use Varchar instead of Int

UltraGaming : atm, use /cuff in your vehicle, you’ll be able to get a player out in the next release :smiley:

Lynton69 : In this simple message, you have the inventory of the player (and it remove illegal item in the same time)

Niko_DEK : [Release] Cops FiveM

I wanted to throw out and idea to the community. I’m going to try and attempt it.

Make your PC microphone connect to the cop car’s loudspeaker and speak through it.

You can say whatever you want to the person in front of you by using the mic.

You could put a filter over the voice output making it sound legit.

Anyways, back to modding.

2 Likes

i have a limitation in smallint and i change on int did not change anything

edit : It’s work thanks you Kyominii for one recolt for all jobs my cuivre jobs don’t work

I have another bugs again and again

/copadd 1

and i don’t use the last essential mode

Hi everybody, Cops V1.0.1 worked well since 1 week … but today nothing work I have the essential error (getplayerfromid) constantly … the script doesn’t run anymore… can you give to us the essential and freeroam please Kyominii ?

Error…