Advertisement
Guest User

Untitled

a guest
Mar 10th, 2018
584
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. ESX = nil
  2. local selling = false
  3.  
  4. Citizen.CreateThread(function()
  5. while ESX == nil do
  6. TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  7. Citizen.Wait(0)
  8. end
  9. end)
  10.  
  11. currentped = nil
  12. Citizen.CreateThread(function()
  13.  
  14. while true do
  15. Wait(0)
  16. local player = GetPlayerPed(-1)
  17. local playerloc = GetEntityCoords(player, 0)
  18. local handle, ped = FindFirstPed()
  19. repeat
  20. success, ped = FindNextPed(handle)
  21. local pos = GetEntityCoords(ped)
  22. local distance = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, playerloc['x'], playerloc['y'], playerloc['z'], true)
  23. if IsPedInAnyVehicle(GetPlayerPed(-1)) == false then
  24. if DoesEntityExist(ped)then
  25. if IsPedDeadOrDying(ped) == false then
  26. if IsPedInAnyVehicle(ped) == false then
  27. local pedType = GetPedType(ped)
  28. if pedType ~= 28 and IsPedAPlayer(ped) == false then
  29. currentped = pos
  30. if distance <= 2 and ped ~= GetPlayerPed(-1) and ped ~= oldped then
  31. drawTxt(0.90, 1.40, 1.0,1.0,0.4, "Press ~g~E ~w~to sell ~r~Weed", 255, 255, 255, 255)
  32. if IsControlJustPressed(1, 38) then
  33. oldped = ped
  34. SetEntityAsMissionEntity(ped)
  35. TaskStandStill(ped, 9.0)
  36. pos1 = GetEntityCoords(ped)
  37. TriggerServerEvent('drugs:trigger')
  38. Citizen.Wait(2850)
  39. TriggerEvent('sell')
  40. local pid = PlayerPedId()
  41. SetEntityAsMissionEntity(oldped)
  42. Wait(450)
  43. RequestAnimDict("amb@prop_human_bum_bin@idle_b")
  44. while (not HasAnimDictLoaded("amb@prop_human_bum_bin@idle_b")) do Citizen.Wait(0) end
  45. TaskPlayAnim(pid,"amb@prop_human_bum_bin@idle_b","idle_d",100.0, 200.0, 0.3, 120, 0.2, 0, 0, 0)
  46. Wait(750)
  47. StopAnimTask(pid, "amb@prop_human_bum_bin@idle_b","idle_d", 1.0)
  48. SetPedAsNoLongerNeeded(oldped)
  49. end
  50. end
  51. end
  52. end
  53. end
  54. end
  55. end
  56. until not success
  57. EndFindPed(handle)
  58. end
  59. end)
  60.  
  61. RegisterNetEvent('sell')
  62. AddEventHandler('sell', function(tt)
  63. local player = GetPlayerPed(-1)
  64. local playerloc = GetEntityCoords(player, 0)
  65. local distance = GetDistanceBetweenCoords(pos1.x, pos1.y, pos1.z, playerloc['x'], playerloc['y'], playerloc['z'], true)
  66.  
  67. if distance <= 2 then
  68. TriggerServerEvent('drugs:sell')
  69. elseif distance > 2 then
  70. TriggerServerEvent('sell_dis')
  71. end
  72. end)
  73.  
  74. function drawTxt(x,y ,width,height,scale, text, r,g,b,a, outline)
  75. SetTextFont(0)
  76. SetTextProportional(0)
  77. SetTextScale(scale, scale)
  78. SetTextColour(r, g, b, a)
  79. SetTextDropShadow(0, 0, 0, 0,255)
  80. SetTextEdge(1, 0, 0, 0, 255)
  81. SetTextDropShadow()
  82. if(outline)then
  83. SetTextOutline()
  84. end
  85. SetTextEntry("STRING")
  86. AddTextComponentString(text)
  87. DrawText(x - width/2, y - height/2 + 0.005)
  88. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement