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 then
- drawTxt(0.90, 1.40, 1.0,1.0,0.4, "Press ~g~E ~w~to sell ~r~Weed", 255, 255, 255, 255)
- if IsControlJustPressed(1, 38) then
- oldped = ped
- SetEntityAsMissionEntity(ped)
- TaskStandStill(ped, 9.0)
- pos1 = GetEntityCoords(ped)
- TriggerServerEvent('drugs:trigger')
- Citizen.Wait(2850)
- TriggerEvent('sell')
- local pid = PlayerPedId()
- SetEntityAsMissionEntity(oldped)
- Wait(450)
- RequestAnimDict("amb@prop_human_bum_bin@idle_b")
- while (not HasAnimDictLoaded("amb@prop_human_bum_bin@idle_b")) do Citizen.Wait(0) end
- TaskPlayAnim(pid,"amb@prop_human_bum_bin@idle_b","idle_d",100.0, 200.0, 0.3, 120, 0.2, 0, 0, 0)
- Wait(750)
- StopAnimTask(pid, "amb@prop_human_bum_bin@idle_b","idle_d", 1.0)
- SetPedAsNoLongerNeeded(oldped)
- 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