You might also want to use "GetVehiclePos" while at it and the actual trailer model.
PHP код:
CMD:printtrailer(playerid, params[])
{
new string[50], Float:tmpCoords[3], trailerID, vehicleid = GetPlayerVehicleID(playerid); // get the id of the vehicle the player is driving
trailerID = GetVehicleTrailer(vehicleid); // get the ID of the trailer attached to the current vehicle
new trailerModel = GetVehicleModel(trailerID); // get the model of the trailer
GetVehiclePos(trailerID, tmpCoords[0], tmpCoords[1], tmpCoords[2]); // get the position of the trailer
format(string, sizeof string, "CreateVehicle(%d, %f, %f, %f, 0, -1, -1, 6000000);", trailerModel, tmpCoords[0], tmpCoords[1], tmpCoords[2]);
SendClientMessageToAll(-1, string);
SendClientMessage(playerid,-1,"Saved");
return 1;
}
This is fully converted to work with trailers only, thus I renamed it to "printtrailer".
EDIT: I think the trailer position is not fully synced in-game; not sure but worth a try. Someone correct me on this.