[Release] [ESX] ESX_CommunityService

ESX_CommunityService

npm version License: GPL v3

PS: I’d be glad if a mod could push me to the releases section.
Special thanks to @juliiiocesar for adding objects to the animations!

INTRODUCTION

An alternative form of punishment and social correction to jail. With this script, you can now send criminals in the central square, to provide community service by cleaning and gardening. Some say it’s more harsh than jail since citizens get to mock you while you are trying to do your time.
Try to escape it and you will get your service extended!

Features:

  • Admin commands
  • You can’t evade service with disconnects.
  • Trying to escape service will result in service extension.

REQUIREMENTS

Download & Installation

Using Git

Manually

Installation

  • Import esx_communityservice.sql in your database
  • Add this in your server.cfg :
    start esx_communityservice

How to apply community service.

  • Use the esx_communityservice:sendToCommunityService(target, service_count) server trigger.
  • Use the /comserv player_id service_count command (only admins).
  • Use the /endcomserv player_id to finish a player’s community service (only admins).

How to add to policejob menu.

Example in esx_policejob: client/main.lua:

{label = _U('fine'),			value = 'fine'},
--add code below (don't forget to add ',' before new row)
{label = "Community Service",	value = 'communityservice'}
		
elseif action == 'unpaid_bills' then
	OpenUnpaidBillsMenu(closestPlayer)
-- add code below
elseif action == 'communityservice' then
	SendToCommunityService(GetPlayerServerId(closestPlayer))
end

--add this function
function SendToCommunityService(player)
	ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'Community Service Menu', {
		title = "Community Service Menu",
	}, function (data2, menu)
		local community_services_count = tonumber(data2.value)
		
		if community_services_count == nil then
			ESX.ShowNotification('Invalid services count.')
		else
			TriggerServerEvent("esx_communityservice:sendToCommunityService", player, community_services_count)
			menu.close()
		end
	end, function (data2, menu)
		menu.close()
	end)
end

Other scripts by me:

[Release] [ESX] ESX_Cargodelivery
[RELEASE] ESX Deliveries

45 Likes

Is there an option to make the police person work? and how long does it take?

You can pretty much send anyone. It doesn’t matter what job one person has. And it’s not time based but action based, which means you have to complete 10 cleaning or gardening actions for instance.

4 Likes

Did someone tell you that he loves you?

If not, I love you <3
I’ve been looking for it for a few months.

Are you able to add it to prison also?
here opsialem 16 hours ago Request job in prison Edit: 01.05.2019 I found a similar action

1 Like

this is a very good script

1 Like

it can easily be modded by changing the coordinates in the config file. But you have to be careful

2 Likes

Are you able to modify it so that if someone does X things at work, it’s slow and if he does not do it will come out after X time?

2 Likes

It goes far beyond my initial design so unfortunately no, as it sounds like a heavy modification also. Feel free to modify it yourself as you please though :slight_smile:

1 Like

I understand correctly

I would like to make props appear when player performs sweeping action

1 Like

I couldn’t figure it out. It is a wish of mine as well. If someone could help i’d be glad. When i figure it out myself i will definitely update the script

@Apostolos_Iatridis
friend, what happens if the person dies in the hospital ?, I have esx ambulancejob.

What do you mean? In theory you can’t die in the hospital since you can’t get there once you are sentenced to community service.

@Apostolos_Iatridis
I mean between player what happens if one player kills another and reappears again in the hospital that occurs with his conviction? sorry for my English

if you check it out, you’ll notice that you can not beat yourself

For anyone who wants to add objects to the animation

1 Like

I’m very happy someone stepped up and contributed but also sad because you beat me to it :smiley:
Great job!

Awesome script!

I’m interested in adding another Service Location in Sandy Shores, any recommendations on how to achieve this?

Thanks!

@Thompson1
I mean between player what happens if one player kills another and reappears again in the hospital that occurs with his conviction? sorry for my English

The player should not be able to act violent. If another player kills the sentenced player im not sure how you handle this but the community service is still there. Player has to complete it before it’s done.

@Voyager24
I’m interested in adding another Service Location in Sandy Shores, any recommendations on how to achieve this?

In order to select different locations where a player can execute community service i have to modify the script quite a bit. Sounds interesting so i will probably implement it as a feature in the future. In the meantime you can change the main location and action locations yourself to make it work. Check out the config.lua file.

Could you tell me where I change the value of the ray that player can walk without being accused of attempting to escape…