Hi! I want to learn lua and I need ur help

I want to write a ped script to he always stay and for example we can buy something from him. How can I do something like this?

Hello there. You can search forum for everything. Example you can use 5M website for natives.

So if you want create ped u need to type in search bar Create Ped:

Like this:

@Kr33jz There is already a release it does that. I can’t find the GitHub of the main author as it seems it got deleted but i have the code. Just make a client.lua and put the code in it and edit it the way you want.

            **--[[SCRIPT MADE BY : ALEXMIHAI04]]--**

---------------------------------------------------------------------

                --[[SCRIPT MADE BY : ALEXMIHAI04]]--

               --[[DO NOT SELL OR COPY THIS SCRIPT]]--

                   --[[github.com/ItsAlexYTB]]--

        --[[ENJOY THE SCRIPT , DO NOT MAKE 1000 NPCS :))))) ]]

---------------------------------------------------------------------

--[[EXPLANATION [EN]: 

-1,2,3 : Coordonates

-4 : Name for the drawtext

-5 : Ped heading

-6 : Ped hash

-7: Ped model

]]--

--[[DO NOT TOUCH IF YOU DON'T KNOW WHAT YOU DO]]--

--[[EXPLANATION [RO]

-1,2,3 : sunt coordonatele de la npc

-4 : Numele care apare deasupra npc-ului

-5 : Heading (partea in care sta orientat)

-6 : Hash de la ped , se poate lua de pe net

-7 : Modelul de la ped , asemenea , il gasiti pe net

]]--

local coordonate = {

    {-1174.85,-1570.79,3.36,"~r~Weed Dealer",143.59,0xE497BBEF,"s_m_y_dealer_01"},

    {110.1,-1950.71,19.6,"~r~DO NOT KILL IN HERE",7.3,0x8D8F1B10,"s_m_y_swat_01"},

    {116.92,-1940.5,19.6,"~r~DO NOT KILL IN HERE",72.01,0x8D8F1B10,"s_m_y_swat_01"},

    {-33.07,-1100.21,25.40,"~r~Car Dealer",72.01,0x5746CD96,"ig_bestmen"},

    {22.69,-1105.53,28.80,"~g~Gun Shop",156.82,0x9E08633D,"s_m_y_ammucity_01"},

    {-42.61,-1107.83,25.40,"~g~Security",160.45,0x56C96FC6,"s_m_m_prisguard_01"},

    {-55.03,-1827.73,25.75,"~g~Garage Security",229.21,0x56C96FC6,"s_m_m_prisguard_01"},

    {-46.73,-1757.89,28.50,"~b~Cashier",52.04,0x18CE57D0,"mp_m_shopkeep_01"},

}

Citizen.CreateThread(function()

    for _,v in pairs(coordonate) do

      RequestModel(GetHashKey(v[7]))

      while not HasModelLoaded(GetHashKey(v[7])) do

        Wait(1)

      end

  

      RequestAnimDict("[email protected][email protected]@[email protected]")

      while not HasAnimDictLoaded("[email protected][email protected]@[email protected]") do

        Wait(1)

      end

      ped =  CreatePed(4, v[6],v[1],v[2],v[3], 3374176, false, true)

      SetEntityHeading(ped, v[5])

      FreezeEntityPosition(ped, true)

      SetEntityInvincible(ped, true)

      SetBlockingOfNonTemporaryEvents(ped, true)

      TaskPlayAnim(ped,"[email protected][email protected]@[email protected]","base", 8.0, 0.0, -1, 1, 0, 0, 0, 0)

    end

end)

Citizen.CreateThread(function()

    while true do

        local pos = GetEntityCoords(GetPlayerPed(-1), true)

        Citizen.Wait(0)

        for _,v in pairs(coordonate) do

            x = v[1]

            y = v[2]

            z = v[3]

            if(Vdist(pos.x, pos.y, pos.z, x, y, z) < 20.0)then

                DrawText3D(x,y,z+2.10, "~g~"..v[4], 1.2, 1)

                DrawText3D(x,y,z+1.95, "~y~RAGRP GUARD", 1.0, 1)

            end

        end

    end

end)

function DrawText3D(x,y,z, text, scl, font) 

    local onScreen,_x,_y=World3dToScreen2d(x,y,z)

    local px,py,pz=table.unpack(GetGameplayCamCoords())

    local dist = GetDistanceBetweenCoords(px,py,pz, x,y,z, 1)

 

    local scale = (1/dist)*scl

    local fov = (1/GetGameplayCamFov())*100

    local scale = scale*fov

   

    if onScreen then

        SetTextScale(0.0*scale, 1.1*scale)

        SetTextFont(7)

        SetTextProportional(1)

        SetTextColour(255, 255, 255, 255)

        SetTextDropshadow(0, 0, 0, 0, 255)

        SetTextEdge(2, 0, 0, 0, 150)

        SetTextDropShadow()

        SetTextOutline()

        SetTextEntry("STRING")

        SetTextCentre(1)

        AddTextComponentString(text)

        DrawText(_x,_y)

    end

end

--[[ENJOY]]--