Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ESX = nil
- local selling = false
- Citizen.CreateThread(function()
- while ESX == nil do
- TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
- Citizen.Wait(0)
- end
- end)
- currentped = nil
- Citizen.CreateThread(function()
- while true do
- Wait(0)
- local player = GetPlayerPed(-1)
- local playerloc = GetEntityCoords(player, 0)
- local handle, ped = FindFirstPed()
- repeat
- success, ped = FindNextPed(handle)
- local pos = GetEntityCoords(ped)
- local distance = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, playerloc['x'], playerloc['y'], playerloc['z'], true)
- if IsPedInAnyVehicle(GetPlayerPed(-1)) == false then
- if DoesEntityExist(ped)then
- if IsPedDeadOrDying(ped) == false then
- if IsPedInAnyVehicle(ped) == false then
- local pedType = GetPedType(ped)
- if pedType ~= 28 and IsPedAPlayer(ped) == false then
- currentped = pos
- if distance <= 2 and ped ~= GetPlayerPed(-1) and ped ~= oldped and IsControlJustPressed(1, 38) then
- oldped = ped
- SetEntityAsMissionEntity(ped)
- TaskStandStill(ped, 9.0)
- pos1 = GetEntityCoords(ped)
- TriggerServerEvent('drugs:trigger')
- Citizen.Wait(2850)
- local pid = PlayerPedId()
- SetEntityAsMissionEntity(oldped)
- Wait(450)
- RequestAnimDict("mp_common")
- while (not HasAnimDictLoaded("mp_common")) do Citizen.Wait(0) end
- TaskPlayAnim(pid,"mp_common","givetake1_a",100.0, 200.0, 0.3, 120, 0.2, 0, 0, 0)
- Wait(750)
- StopAnimTask(pid, "mp_common","givetake1_a", 1.0)
- TriggerEvent('sell')
- SetPedAsNoLongerNeeded(oldped)
- local randomReport = math.random(1, 3)
- if randomReport == 2 then
- TriggerServerEvent('drugs:police')
- exports.pNotify:SetQueueMax("left", 1)
- exports.pNotify:SendNotification({
- text = "Vou chamar a policia",
- type = "error",
- timeout = math.random(100, 3500),
- layout = "centerLeft",
- queue = "left"
- })
- end
- end
- end
- end
- end
- end
- end
- until not success
- EndFindPed(handle)
- end
- end)
- RegisterNetEvent('sell')
- AddEventHandler('sell', function(tt)
- local player = GetPlayerPed(-1)
- local playerloc = GetEntityCoords(player, 0)
- local distance = GetDistanceBetweenCoords(pos1.x, pos1.y, pos1.z, playerloc['x'], playerloc['y'], playerloc['z'], true)
- if distance <= 2 then
- TriggerServerEvent('drugs:sell')
- elseif distance > 2 then
- TriggerServerEvent('sell_dis')
- end
- end)
- function drawTxt(x,y ,width,height,scale, text, r,g,b,a, outline)
- SetTextFont(0)
- SetTextProportional(0)
- SetTextScale(scale, scale)
- SetTextColour(r, g, b, a)
- SetTextDropShadow(0, 0, 0, 0,255)
- SetTextEdge(1, 0, 0, 0, 255)
- SetTextDropShadow()
- if(outline)then
- SetTextOutline()
- end
- SetTextEntry("STRING")
- AddTextComponentString(text)
- DrawText(x - width/2, y - height/2 + 0.005)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement