NPC Taxi job - npc waving

I need help. Im a newb in the dev world etc so i may be asking a really stupid question.

In the npc taxi script if you start a npc job you get the location on the map.
when you arrive at the npc i would like to have them “call the cab” by waving.

My guess is:
this is what is in the code allready to show " press E" .

                        if dist < 5 then
                            local npccoords = GetEntityCoords(NpcData.Npc)
                            DrawText3D(Config.NPCLocations.TakeLocations[NpcData.CurrentNpc].x, Config.NPCLocations.TakeLocations[NpcData.CurrentNpc].y, Config.NPCLocations.TakeLocations[NpcData.CurrentNpc].z, '[E] NPC oproepen')
                            if IsControlJustPressed(0, Keys["E"]) then
                                local veh = GetVehiclePedIsIn(ped, 0)
                                local maxSeats, freeSeat = GetVehicleMaxNumberOfPassengers(vehicle)

can i write something like:
if dist < 10 then
npc starts animation wave

Hope you guys understand what i mean and if you can help.