Advertisement
Seb

Untitled

Seb
Apr 25th, 2022
884
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.07 KB | None | 0 0
  1. RegisterNetEvent('sl-police:client:steal:closest')
  2. AddEventHandler('sl-police:client:steal:closest', function()
  3.     local player, distance = SL.Functions.GetClosestPlayer()
  4.     if player ~= -1 and distance < 2.5 then
  5.         local playerPed = GetPlayerPed(player)
  6.         local playerId = GetPlayerServerId(player)
  7.         if IsEntityPlayingAnim(playerPed, "missminuteman_1ig_2", "handsup_base", 3) or IsEntityPlayingAnim(playerPed, "missminuteman_1ig_2", "handsup_enter", 3) or IsEntityPlayingAnim(playerPed, "mp_arresting", "idle", 3) or IsTargetDead(playerId) then
  8.             SL.Functions.Progressbar("robbing_player", "Fouille les poches..", math.random(5000, 7000), false, true, {
  9.                 disableMovement = true,
  10.                 disableCarMovement = true,
  11.                 disableMouse = false,
  12.                 disableCombat = true,
  13.             }, {
  14.                 animDict = "random@shop_robbery",
  15.                 anim = "robbery_action_b",
  16.                 flags = 16,
  17.             }, {}, {}, function() -- Done
  18.                 local plyCoords = GetEntityCoords(playerPed)
  19.                 local pos = GetEntityCoords(PlayerPedId())
  20.                 local dist = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, plyCoords.x, plyCoords.y, plyCoords.z, true)
  21.                 if dist < 2.5 then
  22.                     StopAnimTask(PlayerPedId(), "random@shop_robbery", "robbery_action_b", 1.0)
  23.                     TriggerServerEvent("sl-inventory:server:OpenInventory", "otherplayer", playerId)
  24.                     TriggerEvent("sl-inventory:server:RobPlayer", playerId)
  25.                 else
  26.                     StopAnimTask(PlayerPedId(), "random@shop_robbery", "robbery_action_b", 1.0)
  27.                     SL.Functions.Notify("Personne autour ! ", "error")
  28.                 end
  29.             end, function() -- Cancel
  30.                 StopAnimTask(PlayerPedId(), "random@shop_robbery", "robbery_action_b", 1.0)
  31.                 SL.Functions.Notify("Annuler...", "error")
  32.             end)
  33.         end
  34.     else
  35.         SL.Functions.Notify("Personne autour ! ", "error")
  36.     end
  37. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement