GetPedNearbyVehicles
Docslocal retval, sizeAndVehs = GetPedNearbyVehicles(ped)Description
Returns size of array, passed into the second variable.
See below for usage information.
This function actually requires a struct, where the first value is the maximum number of elements to return. Here is a sample of how I was able to get it to work correctly, without yet knowing the struct format.
//Setup the array
const int numElements = 10;
const int arrSize = numElements * 2 + 2;
Any veh[arrSize];
//0 index is the size of the array
veh[0] = numElements;
int count = PED::GET_PED_NEARBY_VEHICLES(PLAYER::PLAYER_PED_ID(), veh);
if (veh != NULL)
{
//Simple loop to go through results
for (int i = 0; i < count; i++)
{
int offsettedID = i * 2 + 2;
//Make sure it exists
if (veh[offsettedID] != NULL && ENTITY::DOES_ENTITY_EXIST(veh[offsettedID]))
{
//Do something
}
}
}
Here's the right way to do it (console and pc):
pastebin.com/SsFej963Parameters
| Name | Type | Description |
|---|---|---|
ped | Ped | — |
sizeAndVehs | int* | — |
Quick Snippet: Get Ped Handleped
pedUse this to get the player ped handle for this native.
-- Get the player's ped handle (client-side)
local ped = PlayerPedId()
print("Ped handle: " .. ped)
-- For a specific player's ped (server-side):
-- local targetPed = GetPlayerPed(source)Vehicle Models

adder
alpha
blade
ardent
asea
cogcabrio
baller
blistaPed Models

mp_m_freemode_01
player_zero
ig_agatha
s_m_y_cop_01
s_m_m_gaffer_01
g_m_m_armboss_01
a_c_boar
a_m_m_bevhills_01Returns
intReturns an integer value.