03/03/2022 22:12 
(Esta mensagem foi modificada pela última vez a: 03/03/2022 22:13 por xbruno1000x.)
	
	
	Código:
//by Seregamil
native IsValidVehicle(vehicleid);
new vehicleAttached[ MAX_VEHICLES ] = { INVALID_VEHICLE_ID, ... };
new vehicleTimer[ MAX_VEHICLES ] ;
stock AttachVehicleToVehicle( vehicleid, to_vehicleid, Float: offsetX, Float: offsetY, Float: offsetZ, Float: offsetA, time = 100 ) {
    if( !IsValidVehicle( vehicleid ) || !IsValidVehicle( to_vehicleid ) )
        return INVALID_VEHICLE_ID ;
    if( vehicleAttached[ vehicleid ] != INVALID_VEHICLE_ID )
        return INVALID_VEHICLE_ID ;
        
    vehicleAttached[ vehicleid ] = to_vehicleid ;
    vehicleTimer[ vehicleid ] = SetTimerEx( "updateVehiclesWithAttach", time, false, "iiffffi", vehicleid, to_vehicleid, offsetX, offsetY, offsetZ, offsetA, time );
    return vehicleid ;
}
stock DeAttachVehicle( vehicleid ) {
    vehicleAttached[ vehicleid ] = INVALID_VEHICLE_ID ;
    KillTimer( vehicleTimer[ vehicleid ] );
}
forward updateVehiclesWithAttach( vehicleid, to_vehicleid, Float: offsetX, Float: offsetY, Float: offsetZ, Float: offsetA, time ) ;
public updateVehiclesWithAttach( vehicleid, to_vehicleid, Float: offsetX, Float: offsetY, Float: offsetZ, Float: offsetA, time ) {
    if( !IsValidVehicle( vehicleid ) || !IsValidVehicle( to_vehicleid ) )
        return ;
    new Float: x, Float: y, Float: z, Float: a ;
    
    GetVehiclePos( to_vehicleid, x, y, z );
    GetVehicleZAngle( to_vehicleid, a );
    SetVehiclePos( vehicleid, x + offsetX, y + offsetY, z + offsetZ );
    SetVehicleZAngle( vehicleid, a );
    vehicleTimer[ vehicleid ] = SetTimerEx( "updateVehiclesWithAttach", time, false, "iifffi", vehicleid, to_vehicleid, offsetX, offsetY, offsetZ, offsetA, time );
}Não existe uma função nativa para isso. Mas existe esse código feito por scripters para essa função.
OBS: não faça post's de dúvidas em geral na área mobile. A área mobile é exclusiva para problemas que só ocorrem em mobile.
Discente de Sistemas de Informação no Centro Federal de Ensino Tecnológico(CEFET/RJ)
Programador SA-MP desde 2012
Programador SA-MP desde 2012
Não envie dúvidas por inbox, crie um tópico. Sua dúvida pode ser a dúvida de outro alguém, e seu tópico ajudará outras pessoas no futuro.
