Advertisement
Guest User

Untitled

a guest
Jul 13th, 2017
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.89 KB | None | 0 0
  1. local generalLoaded = false
  2. local playingAnimation = false
  3.  
  4. local ShopClerk = {
  5.     {id = 1, modelHash = "mp_m_shopkeep_01", x = -2511.16479492188, y = 3616.90478515625, z = 13.6422147750854, heading = 245.000457763672},
  6.     {id = 2, modelHash = "mp_m_shopkeep_01", x = 24.392505645752, y = -1345.41369628906, z = 29.4970207214355, heading = 264.900115966797},
  7.     {id = 3, modelHash = "mp_m_shopkeep_01", x = -47.3110542297363, y = -1758.62475585938, z = 29.4209995269775, heading = 48.1558074951172},
  8.     {id = 4, modelHash = "mp_m_shopkeep_01", x = -2504.181640625, y = 3599.275390625, z = 14.4641599655151, heading = 146.33984375},
  9. }
  10.  
  11. local blips = {
  12.     {x = -2511.164, y = 3616.904, z = 13.64},
  13.     {x = 24.392, y = -1345.413, z = 29.497},
  14.     {x = -47.311, y = -1758.624, z = 29.420},
  15.     {x = -2504.181, y = 3599.275, z = 14.464},
  16. }
  17.  
  18. for _, item in pairs(blips) do
  19.     item.blip = AddBlipForCoord(item.x, item.y, item.z)
  20.     SetBlipSprite(item.blip, 52)
  21.     SetBlipColour(item.blip, 5)
  22.     SetBlipAsShortRange(item.blip, true)
  23.     BeginTextCommandSetBlipName("STRING")
  24.     AddTextComponentString('Clerks')
  25.     EndTextCommandSetBlipName(item.blip)
  26. end
  27.  
  28. Citizen.CreateThread(function()
  29.   while true do
  30.     Citizen.Wait(0)
  31.    
  32.     playerPed = GetPlayerPed(-1)
  33.     playerCoords = GetEntityCoords(playerPed, 0)
  34.    
  35.     if (not generalLoaded) then
  36.         for i=1, #ShopClerk do
  37.             RequestModel(ShopClerk[i].modelHash)
  38.             while not HasModelLoaded(ShopClerk[i].modelHash) do
  39.               Wait(1)
  40.             end
  41.  
  42.             ShopClerk[i].id = CreatePed(2, ShopClerk[i].modelHash, ShopClerk[i].x, ShopClerk[i].y, ShopClerk[i].z, ShopClerk[i].heading, true)
  43.         end
  44.        
  45.         generalLoaded = true
  46.     end
  47.  
  48.     RequestAnimDict("random@shop_gunstore")
  49.     while (not HasAnimDictLoaded("random@shop_gunstore")) do
  50.         Citizen.Wait(0)
  51.     end
  52.  
  53.         for i=1, #ShopClerk do
  54.             distance = GetDistanceBetweenCoords(ShopClerk[i].x, ShopClerk[i].y, ShopClerk[i].z, GetEntityCoords(GetPlayerPed(-1)))
  55.             if distance < 6 and PlayingAnim ~= true then
  56.                 TaskPlayAnim(ShopClerk[i].id,"random@shop_gunstore","_greeting", 1.0, -1.0, 4000, 0, 1, true, true, true)
  57.                 PlayingAnim = true
  58.                 Citizen.Wait(4000)
  59.                 if PlayingAnim == true then
  60.                     TaskPlayAnim(ShopClerk[i].id,"random@shop_gunstore","_idle_b", 1.0, -1.0, -1, 0, 1, true, true, true)
  61.                 end
  62.             else
  63.                 TaskPlayAnim(ShopClerk[i].id,"random@shop_gunstore","_idle_b", 1.0, -1.0, -1, 0, 1, true, true, true)
  64.             end
  65.         end
  66.     end
  67. end)
  68.  
  69. Citizen.CreateThread(function() -- This Sortoff fixes it, not the cleanest fix but "working".
  70.     while true do
  71.         Citizen.Wait(0)
  72.         local Door = {{x = 29.054, y = -1350.059, z = 29.33}}
  73.         for _, Door in pairs(Door) do
  74.             DrawMarker(1, Door.x, Door.y, Door.z, 0, 0, 0, 0, 0, 0, 1.001, 1.0001, 0.5001, 0, 255, 0, 255, 0, 0, 0, 0)
  75.             local luld = GetDistanceBetweenCoords(Door.x, Door.y, Door.z, GetEntityCoords(GetPlayerPed(-1)))
  76.             if luld < 1 then
  77.                 PlayingAnim = false
  78.             end
  79.         end
  80.     end
  81. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement