@Lenzh_FX
It would be possible to define number of police officers online so that you can cut the vehicle
Yes thats possible
@Lenzh_FX
I looked at config but I did not find it
is it on client / main.lua ??
Could you show me which line
config.lua
Config.CopsRequired = 3
server.lua
ESX.RegisterServerCallback('Lenzh_chopshop:anycops',function(source, cb)
local anycops = 0
local playerList = GetPlayers()
for i=1, #playerList, 1 do
local _source = playerList[i]
local xPlayer = ESX.GetPlayerFromId(_source)
local playerjob = xPlayer.job.name
if playerjob == 'police' then
anycops = anycops + 1
end
end
cb(anycops)
end)
client.lua
ESX.TriggerServerCallback('Lenzh_chopshop:isCooldown', function(cooldown)
if cooldown <= 0 then
ESX.TriggerServerCallback('Lenzh_chopshop:anycops', function(anycops)
if anycops >= Config.CopsRequired then
after last pNotify that states the vehicle has been chopped
else
ESX.ShowNotification(_U('not_enough_cops'))
end
end)
and locale
[‘not_enough_cops’] = ‘Not enough cops in service’
Hey man, I wanted to make something just like this and took apart your script to use as the base. I made a few optimizations I can send you if you’d like to see. I noticed you update this script a lot and had comments for some nice features so I added those. For example, your VehiclePartsRemoval() can basically be done with
local ped = PlayerPedId()
local vehicle = GetVehiclePedIsIn( ped, false )
local doors = GetNumberOfVehicleDoors(vehicle)
for i = 0,doors do
if DoesVehicleHaveDoor(vehicle, i) then
SetVehicleDoorShut(vehicle, i, false )
Wait(2000)
SetVehicleDoorOpen(vehicle, i, false, false)
Wait(5000)
SetVehicleDoorBroken(vehicle, i, true)
end
end
That just checks any vehicle for its max doors and checks if the door is attached, if so then close it then open it fully, wait and then delete.
I was able to remove the functions you used to check for passengers and used this function
function butts(vehicle)
local meh = GetVehicleNumberOfPassengers(vehicle)
return meh
end
local seats = butts(vehicle)
if seats ~= 0 then
TriggerEvent('chat:addMessage', { args = { '[^1Chopshop^0]: Cannot chop with passengers' } })
end
I did that cause I don’t care if they are actually the driver, I just don’t want more than one person in the car to be able to start a 2nd chop process while this one is active. I also use that function again before I reward the player to make sure they are still a lone in the car at the end of the chop process. The cooldown callback prevents this as well.
For the cooldown you can take a look at esx_advancedrobbery and see how that resource uses os.timer() to make a cooldown. I made this callback to make the chopshop usable once every hour. This way its just a 1 time check instead of using your cooldown manager.
local TimeBeforeNewRob = 3600
local lastrobbed = 0
ESX.RegisterServerCallback('Lenzh_chopshop:isCooldown',function(source, cb)
if lastrobbed ~= 0 and (os.time() - lastrobbed) < TimeBeforeNewRob then
--local timerNewRob = TimeBeforeNewRob - (os.time() - lastrobbed)
--print('timeleft is '..timerNewRob)
cb(true)
else
cb(false)
end
end)
The cooldown is triggered when the client begins the actual chop process with
client:
TriggerServerEvent('Lenzh_chopshop:BerryTime')
which is this on the server side
server:
RegisterServerEvent('Lenzh_chopshop:BerryTime')
AddEventHandler('Lenzh_chopshop:BerryTime', function()
lastrobbed = os.time()
end)
Instead of copying esx_outlawalert into your script, if you look at the newest releast of it you can see an update for isPlayerWhitelisted. You can most likely make a function within that resource which returns true if whitelisted and then export that function into your chopshop for a cop check and trigger a blip to them with that.
Some other stuff I had is moving your markers and blips off to a separate markers.lua, adding a vehicle class check to only allow certain vehicle types, and some other fluff. Keep in mind, if you spawn an NPC like that and people use a default esx_drugstonpc or a mugging script, they can sell and mug that NPC again and again. You are also going to want to change the way you prevent players from driving the vehicle after starting the chop process.
I wouldn’t use
SetVehicleUndriveable(vehicle, false)
If someone disconnects, crashes or drops while chopping I am pretty sure this leaves the vehicle stuck in the marker and a normal client wont be able to start or move it.
Try something like this instead, I think this should work. You can probably slim this function down even more.
Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
if turnEngineOff then
local nowVehicle = GetVehiclePedIsIn(PlayerPedId())
if nowVehicle then
SetVehicleEngineOn(nowVehicle, false, false, true)
end
if (not IsPedInAnyVehicle(PlayerPedId(), false) and turnEngineOff) then
currentlyChopping = false
turnEngineOff = false
end
end
end
end)
I used currentlyChopping as my global variable and you can just set turnEngineOff = true/false if you wanna toggle the engine. We can prevent players from manually turning the engine on and driving off with that. This also checks if a player leaves the vehicle after starting the job and cancels it if they did.
Thanks for releasing this, hopefully this helps you out for the next update. I’ll send you the full resource just message me.
So I’m guessing this now requires progressBars script cause I’m getting errors like crazy cause I don’t have that resource. Here is the link to progressBars if you want his update to actually work [RELEASE] Progress Bars 1.0 [STANDALONE]
@SoldatMI
I belive you do, he posted in my progress bar resource that he is happy to have it in his chop shop resource. It is easy to install just put it in your reousrces folder and auto start it and you should be able to use this resource fully!
Well if you read the github readme. It clearly state you need it. So always read the readme. Even between each update. You never what requirement will be added. But next update we will add dependency in __resource.lua
I can understand that but note it in the release to, not everyone will read it. No hate just wasn’t expecting it by reading the release notes lol
Sound fair enough. We will do that too. Just to help you guys out and minimizing question. Also the dependency will help too. As upon starting server it will tell you that your missing a script in order to run it.
Feel free to make a pr so ill look into it or message me on discord server is on github
Everything works except after selling something and exiting the npc shop, all other menus, for example mask menu or animation menu closes automtically when opening.
Only way to fix is restarting the script.
Just from watching video I think it is stopping because you are set as police officer. Try without being police to see if it works.
Below is same as above with google translate
เพียงแค่ดูวิดีโอฉันคิดว่ามันหยุดเพราะคุณถูกกำหนดให้เป็นเจ้าหน้าที่ตำรวจ ลองโดยไม่ต้องเป็นตำรวจเพื่อดูว่าใช้งานได้หรือไม่
Google แปลใช้หวังว่านี่จะช่วยได้
Try to rename your progressBars-1.0 folder in progressBars. Start it before Chopshop in your server.cfg
Is the script giving any errors in console (f8) seems like it stops when looking for the progress bars so might be missing that script.
translated:
เป็นสคริปต์ที่ให้ข้อผิดพลาดในคอนโซล (f8) ดูเหมือนว่าจะหยุดเมื่อมองหาแถบความคืบหน้าดังนั้นอาจจะหายไปสคริปต์ที่
anyone working on client cool downs?
Nice release…
just a suggestion add a checker to see if the vehicle is 2 or 4 doors to not run the rear doors part if it’s only has 2 doors.
yes i am
working on it
Any chance you have ever looked into instead of having player just sit in car while parts just vanish. You find door - set marker and player has to select to remove part - does mechanic animation and the script moves to next part.
So the player actually has to remove parts vs just having parts removed?
I love your script execpt for this one part.
SpikE