Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function POLICE_removeOrPlaceHerse()
- local coords = GetEntityCoords(GetPlayerPed(-1), true)
- local heading = GetEntityHeading(GetPlayerPed(-1))
- local hashHerse = GetHashKey("P_ld_stinger_s")
- local herse = GetClosestObjectOfType( coords.x, coords.y, coords.z, 0.9, hashHerse, false, false, false)
- print(herse)
- if herse ~= 0 then
- print('HERSE')
- -- On supprime les herses
- RemoveHerse(herse)
- else
- print('NO HERSE')
- -- On ajoute la herse
- RequestModel(hashHerse)
- while not HasModelLoaded(hashHerse) do
- Citizen.Wait(1)
- end
- local herse = CreateObject('P_ld_stinger_s', coords.x, coords.y, coords.z - 2, true, true, true)
- PlaceObjectOnGroundProperly(herse)
- SetEntityHeading(herse, heading)
- SetNetworkIdCanMigrate(id, true)
- end
- end
- function RemoveHerse(herse)
- NetworkRequestControlOfEntity(herse)
- Citizen.InvokeNative(0xB736A491E64A32CF, Citizen.PointerValueIntInitialized(herse))
- Citizen.InvokeNative(0x539E0AE3E6634B9F, Citizen.PointerValueIntInitialized(herse))
- DeleteObject(herse)
- SetEntityCoords(herse, -2000.0, -2000.0, -2000.0)
- end
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- local ped = GetPlayerPed(-1)
- local veh = GetVehiclePedIsIn(ped, false)
- local vehCoord = GetEntityCoords(veh)
- local hashHerse = GetHashKey("P_ld_stinger_s")
- if IsPedInAnyVehicle(ped, false) then
- local herse = GetClosestObjectOfType( vehCoord.x, vehCoord.y, vehCoord.z, 1.3, hashHerse, false, false, false)
- if herse ~= 0 then
- print(herse)
- RemoveHerse(herse)
- SetVehicleTyreBurst(veh, 0, true, 1000.0)
- SetVehicleTyreBurst(veh, 1, true, 1000.0)
- Citizen.Wait(200)
- SetVehicleTyreBurst(veh, 2, true, 1000.0)
- SetVehicleTyreBurst(veh, 3, true, 1000.0)
- Citizen.Wait(200)
- SetVehicleTyreBurst(veh, 4, true, 1000.0)
- SetVehicleTyreBurst(veh, 5, true, 1000.0)
- SetVehicleTyreBurst(veh, 6, true, 1000.0)
- SetVehicleTyreBurst(veh, 7, true, 1000.0)
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement