Trying to make a script to where if you are within 50 cordinates of this it picks something up so far I have this
===========================================================================================
----------------
-- E D I T --
----------------
local StartPicking_KEY = 20 -- Z
local Caught_KEY = 201 -- ENTER
local SuccessLimit = 0.09 -- Maxim 0.1 (high value, low success chances)
local AnimationSpeed = 0.0015
local ShowChatMSG = true -- or false
local WeedDistance = 10
----------------
-- C O D E --
----------------
-- V A R S
local IsPicking = false
local CPick = false
local BarAnimation = 0
local Faketimer = 0
local RunCodeOnly1Time = true
local PosX = 0.5
local PosY = 0.1
local TimerAnimation = 0.1
-- T H R E A D
Citizen.CreateThread(function()
while true do Citizen.Wait(1)
if IsControlJustPressed(1, StartPicking_KEY) then
if not IsPedInAnyVehicle(GetPed(), false) then
if not IsPedSwimming(GetPed()) then
if IsEntityInWater(GetPed()) then
IsPicking = true
if ShowChatMSG then Chat(msg[1]) end
RunCodeOnly1Time = true
BarAnimation = 0
else
if ShowChatMSG then Chat('^1'..msg[6]) end
end
end
end
end
while IsPicking do
local time = 4*3000
TaskStandStill(GetPed(), time+7000)
FishRod = AttachEntityToPed('prop_ld_shovel',60309, 0,0,0, 0,0,0)
PlayAnim(GetPed(),'amb@world_human_const_drill@male@drill@base','base',4,3000)
Citizen.Wait(time)
CPick = true
IsPicking = false
end
while CPick do
Citizen.Wait(1)
FishGUI(true)
if RunCodeOnly1Time then
Faketimer = 1
PlayAnim(GetPed(),'amb@world_human_gardener_plant@female@idle_a','idle_c',1,0) -- 10sec
RunCodeOnly1Time = false
end
if TimerAnimation <= 0 then
CPick = false
TimerAnimation = 0.1
StopAnimTask(GetPed(), 'amb@world_human_gardener_plant@female@idle_a','idle_c',2.0)
Citizen.Wait(200)
DeleteEntity(FishRod)
if ShowChatMSG then Chat('^1'..msg[2]) end
end
if IsControlJustPressed(1, Caught_KEY) then
if BarAnimation >= SuccessLimit then
CPick = false
TimerAnimation = 0.1
if ShowChatMSG then Chat('^2'..msg[3]) end
StopAnimTask(GetPed(), 'amb@world_human_gardener_plant@female@idle_a','idle_c',2.0)
Citizen.Wait(200)
DeleteEntity(FishRod)
else
CPick = false
TimerAnimation = 0.1
StopAnimTask(GetPed(), 'amb@world_human_gardener_plant@female@idle_a','idle_c',2.0)
Citizen.Wait(200)
DeleteEntity(FishRod)
if ShowChatMSG then Chat('^1'..msg[4]) end
end
end
end
end
end)
Citizen.CreateThread(function() -- Thread for timer
while true do
Citizen.Wait(1000)
Faketimer = Faketimer + 1
end
end)
local twentyfourseven_shops = {
{ ['x'] = 2220.83, ['y'] = 5576.12, ['z'] = 53.6079 },
}
Citizen.CreateThread(function()
for k,v in ipairs(twentyfourseven_shops)do
local blip = AddBlipForCoord(v.x, v.y, v.z)
SetBlipSprite(blip, 140)
SetBlipScale(blip, 0.8)
SetBlipColour(blip, 52)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Weed")
EndTextCommandSetBlipName(blip)
end
end)
-- F U N C T I O N S
function GetCar() return GetVehiclePedIsIn(GetPlayerPed(-1),false) end
function GetPed() return GetPlayerPed(-1) end
function text(x,y,scale,text)
SetTextFont(0)
SetTextProportional(0)
SetTextScale(scale, scale)
SetTextColour(255,255,255,255)
SetTextDropShadow(0,0,0,0,255)
SetTextEdge(2, 0, 0, 0, 255)
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(x, y)
end
function FishGUI(bool)
if not bool then return end
DrawRect(PosX,PosY+0.005,TimerAnimation,0.005,255,255,0,255)
DrawRect(PosX,PosY,0.1,0.01,0,0,0,255)
TimerAnimation = TimerAnimation - 0.0001025
if BarAnimation >= SuccessLimit then
DrawRect(PosX,PosY,BarAnimation,0.01,102,255,102,150)
else
DrawRect(PosX,PosY,BarAnimation,0.01,255,51,51,150)
end
if BarAnimation <= 0 then
up = true
end
if BarAnimation >= PosY then
up = false
end
if not up then
BarAnimation = BarAnimation - AnimationSpeed
else
BarAnimation = BarAnimation + AnimationSpeed
end
text(0.4,0.05,0.35, msg[5])
end
function PlayAnim(ped,base,sub,nr,time)
Citizen.CreateThread(function()
RequestAnimDict(base)
while not HasAnimDictLoaded(base) do
Citizen.Wait(1)
end
if IsEntityPlayingAnim(ped, base, sub, 3) then
ClearPedSecondaryTask(ped)
else
for i = 1,nr do
TaskPlayAnim(ped, base, sub, 8.0, -8, -1, 16, 0, 0, 0, 0)
Citizen.Wait(time)
end
end
end)
end
function AttachEntityToPed(prop,bone_ID,x,y,z,RotX,RotY,RotZ)
BoneID = GetPedBoneIndex(GetPed(), bone_ID)
obj = CreateObject(GetHashKey(prop), 1729.73, 6403.90, 34.56, true, true, true)
vX,vY,vZ = table.unpack(GetEntityCoords(GetPed()))
xRot, yRot, zRot = table.unpack(GetEntityRotation(GetPed(),2))
AttachEntityToEntity(obj, GetPed(), BoneID, x,y,z, RotX,RotY,RotZ, false, false, false, false, 2, true)
return obj
end
function Chat(text)
TriggerEvent("chatMessage", 'SYSTEM', { 255,255,0}, text)
end
=================================================================================================
But how would I add the infamous
VDK_Inventory (player:receive)
Player location with every tick
Basically what I want to do is say If you are within 50 feet/cordinates/foots , when you press z you start digging and then when you get the chance of it you press enter to get to the green , if you get it to the green you get the weed. Then I will take the blip off and make it to where there is as custom informant and I will just change everything else to cocaine , drugs and end up making my own drugs mod and give credit to the people who helped me , can anyone please help me Sorry for my grammar
SO BASICALLY I need help with
- Get player position
- Get distance (native VDIST) to the coordinate you mention
- If distance < SOME_RADIUS then do what you want to do
and doing player:recieve (VDK_Inventory)