{"hash":"0x0E558D3A49D759D6","ns":"VEHICLE","name":"_GET_ALL_WAGON_PASSENGERS","slug":"_GET_ALL_WAGON_PASSENGERS","official":false,"named":true,"luaName":"GetAllWagonPassengers","game":"rdr3","apiset":"client","returnType":"int","params":[{"name":"wagon","type":"Vehicle"},{"name":"itemSet","type":"ItemSet"}],"summary":"Collects all passenger peds (excluding the driver) from the specified wagon-type vehicle (train wagon) and appends them to itemSet as indexed items.","descriptions":[{"source":"alloc8or","format":"text","body":"Collects all passenger peds (excluding the driver) from the specified wagon-type vehicle (train wagon) and appends them to itemSet as indexed items. Returns the number of passengers added (0 if none / invalid / non-wagon).\n\nNotes:\n\t- Only works on wagon entities (train wagons). Regular vehicles/coaches typically return 0.\n\t- Clear the itemset before calling.\n\t- If you also need the driver, query GET_DRIVER_OF_VEHICLE(wagon) and handle/add it separately (see scripts).\n\t- Resolve returned entries via indexed item helpers:\n\t\tPed p = MISC::_GET_PED_FROM_INDEXED_ITEM(ITEMSET::GET_INDEXED_ITEM_IN_ITEMSET(i, itemSet));\n\t\t(or: Entity e = MISC::_GET_ENTITY_FROM_ITEM(...); then ENTITY::GET_PED_INDEX_FROM_ENTITY_INDEX(e)).\n\t- Wagon auto-population can be toggled via ENTITY::_0x119A5714578F4E05(wagon, bool); scripts disable it in some flows.\n\nExample image: https://imgur.com/a/2V8Uk2K\n\nExample (C++):\n\tItemSet set = ITEMSET::CREATE_ITEMSET(true);\n\tITEMSET::_CLEAR_ITEMSET(set);\n\tint count = VEHICLE::_GET_ALL_WAGON_PASSENGERS(wagon, set);\n\tfor (int i = 0; i < count; ++i) {\n\t\tPed p = MISC::_GET_PED_FROM_INDEXED_ITEM(ITEMSET::GET_INDEXED_ITEM_IN_ITEMSET(i, set));\n\t\tif (ENTITY::DOES_ENTITY_EXIST(p) && !ENTITY::IS_ENTITY_DEAD(p)) {\n\t\t\t// ...\n\t\t}\n\t}\n\tITEMSET::DESTROY_ITEMSET(set);"},{"source":"vorp","format":"text","body":"Collects all passenger peds (excluding the driver) from the specified wagon-type vehicle and adds them as indexed items to the provided itemset.\nNotes:\n- Always clear the itemset before calling.\n- Returns 0 if the wagon is empty or auto-population is disabled\n  (ENTITY::_0x119A5714578F4E05(wagon, false)).\n- Itemset may contain dead peds; filter with IS_ENTITY_DEAD if needed.\n- Often used alongside wagon auto-population management."}],"examples":[],"aliases":["_GET_ALL_TRAIN_WAGON_PASSENGERS"],"enums":[],"related":[],"build":"1207","sources":["alloc8or","vorp"],"doc":2,"url":"https://natives.borderlinerp.com/natives/VEHICLE/_GET_ALL_WAGON_PASSENGERS","markdownUrl":"https://natives.borderlinerp.com/natives/VEHICLE/_GET_ALL_WAGON_PASSENGERS.md","snippets":{"lua":"local retval = GetAllWagonPassengers(wagon, itemSet)","luaInvoke":"local retval = Citizen.InvokeNative(0x0E558D3A49D759D6, wagon, itemSet, Citizen.ResultAsInteger())","js":"const retval = GetAllWagonPassengers(wagon, itemSet);","jsInvoke":"const retval = Citizen.invokeNative('0x0E558D3A49D759D6', wagon, itemSet, Citizen.returnResultAnyway(), Citizen.resultAsInteger());","csharp":"int retval = Function.Call<int>((Hash)0x0E558D3A49D759D6, wagon, itemSet);","notes":["The name is a community guess and may change. If the named call is missing in your client build, use `InvokeNative` with the hash — it always works."]}}