Haha what a coincidence, I actually wrote Skylift pickup code that works for online players' vehicles two days ago. You have to get control of their network id of course. I got rid of the get_closest_car method because I wasn't sure that it included other player's cars (just game ped/parked ones). Instead mine works by selecting the username manually, then it teleports them to me and attaches.
I integrated this into my menu's online player loop with it's own option to enable/disable. It's already been tested as working.
Code:
if(DOES_CHAR_EXIST(players[index].ped)){
if(IS_CHAR_IN_ANY_CAR(pPlayer)){
if(IS_CHAR_IN_ANY_CAR(players[index].ped)){
float heading,px,py,pz,pheight;
float offset_y = -2.8, offset_z = 0.65;
int nvid,tick,driver;
GET_CAR_CHAR_IS_USING(players[index].ped,&pveh);
GET_CAR_CHAR_IS_USING(pPlayer,&paveh);
GET_DRIVER_OF_CAR(paveh,&driver);
if((driver == pPlayer) && (IS_CHAR_IN_MODEL(pPlayer, MODEL_SKYLIFT))){
GET_NETWORK_ID_FROM_VEHICLE(pveh,&nvid);
REQUEST_CONTROL_OF_NETWORK_ID(nvid);
while(!HAS_CONTROL_OF_NETWORK_ID(nvid)){
tick++;
REQUEST_CONTROL_OF_NETWORK_ID(nvid);
if(tick >= 200){
print("Error");
return;
}
WAIT(0);
}
if(!IS_CAR_ATTACHED(pveh)){
pheight = GET_HEIGHT_OF_VEHICLE(pveh,px,py,pz,false,true);
if (IS_BIG_VEHICLE(pveh)){
offset_y = -3.5;
offset_z = 0.90;
}
GET_CAR_HEADING(paveh,&heading);
GET_CHAR_COORDINATES(pPlayer,&x,&y,&z);
SET_CAR_HEADING(pveh,heading);
teleport_char(players[index].ped,x,y,z);
FREEZE_CAR_POSITION(pveh,true);
ATTACH_CAR_TO_CAR(pveh,paveh,0,0.0,offset_y,pheight-offset_z,0.0,0.0,0.0);
LOCK_CAR_DOORS(paveh,4);
LOCK_CAR_DOORS(pveh,4);
print_long("Vehicle attached to magnet.");
return;
}
else if(IS_CAR_ATTACHED(pveh)){
LOCK_CAR_DOORS(paveh,1);
LOCK_CAR_DOORS(pveh,1);
FREEZE_CAR_POSITION(pveh,false);
DETACH_CAR(pveh);
print("Vehicle detached from magnet.");
return;
}
}
else print("You must driving a Skylift.");
}
else print("Player is not in a vehicle.");
}
else print("You are not in a Skylift.");
}
Obvious thanks here goes to Three-Socks and EmmanuelU.
Edit: And for the record, someone attached me to their Skylift something like three months ago in a multiplayer game. They had all kinds of 'advanced' stuff for that time, including some things I still have yet to see or hear about. Wouldn't tell me what menu they were using other than it was private.