Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local T_RandChrochetage = math.random(40000, 90000) --temps du crochetage
- local T_AlarmeAfterCrochetage = 60000 -- temps de l alarme apres crochetage
- local percentAlarmV2 = 100 --% d avoir une alarme V2
- local T_StartAlarmV2 = 15000 --Timer avant de start l alarme V2 apres crochetage
- local T_StopAlarmV2 = 15000 -- timer avant de libéré le joueurs du vehicul si pas de police
- local alarmRun = false
- local player = GetPlayerPed(-1)
- Citizen.CreateThread(function()
- RequestAnimDict("mini@repair")
- while not HasAnimDictLoaded("mini@repair") do
- Wait(1)
- end
- end)
- function SetOnAlarmVeh(veh)
- Citizen.CreateThread(function()
- while alarmRun do
- SetVehicleAlarm(veh, true)
- StartVehicleAlarm(veh)
- Wait(10000)
- Citizen.Trace("Fin boucle SetOnAlarmVeh")
- end
- end)
- end
- function TimerAlarmRunning(veh)
- if alarmRun == false then
- alarmRun = true
- Citizen.Trace("AlarmRun is true")
- SetOnAlarmVeh(veh)
- else
- alarmRun = false
- Citizen.Trace("AlarmRun is false")
- end
- end
- function CheckIfPlayerIsinVeh(veh, player)
- local driver = GetPedInVehicleSeat(veh, -1)
- if driver == player then
- Citizen.Trace("meme ped comme conducteur")
- end
- end
- Citizen.CreateThread(function()
- while true do
- Wait(0)
- if DoesEntityExist(GetVehiclePedIsTryingToEnter(PlayerPedId())) then
- local veh = GetVehiclePedIsTryingToEnter(PlayerPedId())
- local lock = GetVehicleDoorLockStatus(veh)
- if lock == 7 then
- SetVehicleDoorsLocked(veh, 2)
- end
- local pedd = GetPedInVehicleSeat(veh, -1)
- if pedd then
- SetPedCanBeDraggedOut(pedd, false)
- end
- if lock == 2 then
- DisplayHelpText("Pressez ~INPUT_CONTEXT~ pour crocheter le véhicule")
- if IsControlJustPressed(0, 38) then
- Lockpick(veh)
- Wait(T_RandChrochetage)
- TimerAlarmRunning(veh)
- end
- end
- end
- end
- end)
- function Lockpick(veh)
- local bool = true
- local anim = true
- TimerAlarmRunning(veh)
- Citizen.CreateThread(function()
- local entcoords = GetEntityCoords(GetPlayerPed(-1), 0)
- drawNotification("~r~Vous crochetez le véhicule !!")
- Citizen.Wait(T_RandChrochetage)
- SetVehicleDoorsLocked(veh, 1)
- drawNotification("~g~Vous avez crocheter le véhicule !!")
- ClearPedTasksImmediately(GetPlayerPed(-1))
- StartAlarmV2(veh)
- anim = false
- Wait(T_AlarmeAfterCrochetage)
- bool = false
- end)
- Citizen.CreateThread(function()
- while anim do
- TaskPlayAnim(GetPlayerPed(-1),"mini@repair","fixing_a_player", 8.0, 0.0, 120000, 16, 0, 0, 0, 0)
- if not anim then
- ClearPedTasksImmediately(GetPlayerPed(-1))
- end
- Wait(10000)
- end
- end)
- end
- function StartAlarmV2(veh)
- Citizen.CreateThread(function()
- local isV2Alarme = math.random(0, 100)
- if isV2Alarme < percentAlarmV2 then
- Wait(T_StartAlarmV2)
- CheckIfPlayerIsinVeh(veh, player)
- Citizen.Trace("debut V2")
- SetVehicleDoorsLocked(veh, 4)
- SetVehicleWheelsCanBreak(veh, false)
- SetVehicleUndriveable(veh, 1)
- drawNotification("~r~Systeme d'alarmeV2 de la voiture activé")
- stopalarm(T_StopAlarmV2, veh)
- end
- end)
- end
- function stopalarm(timer, veh)
- Citizen.CreateThread(function()
- Citizen.Trace("stop alarms 1/2")
- Citizen.Wait(timer)
- Citizen.Trace("stop alarms 2/2")
- SetVehicleDoorsLocked(veh, 1)
- drawNotification("~g~Systeme d'alarmeV2 de la voiture désactivé")
- end)
- end
- function DisplayHelpText(str)
- SetTextComponentFormat("STRING")
- AddTextComponentString(str)
- DisplayHelpTextFromStringLabel(0, 0, 1, -1)
- end
- function drawNotification(text)
- SetNotificationTextEntry("STRING")
- AddTextComponentString(text)
- DrawNotification(false, false)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement