GTA Közösség - A magyar GTA fórum

San Andreas Multiplayer (SA-MP) => Szkript kérések => SA-MP: Szerverfejlesztés => RP/RPG kérések => A témát indította: dodo99 - 2015. Július 13. - 20:52:18

Cím: Jármű-Jármű összekötés
Írta: dodo99 - 2015. Július 13. - 20:52:18
Sziasztok! Azt milyen kóddal lehet megoldani hogy DFT-30-asra tudjak járművet attacholni? Láttam már ilyet afterlifeba de még nem is gondoltam rá.
Az ilyen attach vehicle to vehicle FS-el hagyjatok kérlek :)
Cím: Jármű-Jármű összekötés
Írta: almightymartin - 2015. Július 13. - 21:10:08
[gmod]Kategorizáltam![/gmod]
Cím: Jármű-Jármű összekötés
Írta: Flash - 2015. Július 13. - 22:46:22
https://wiki.sa-mp.com/wiki/AttachObjectToVehicle
Cím: Jármű-Jármű összekötés
Írta: dodo99 - 2015. Július 14. - 02:09:34
Idézetet írta: Flash date=1436820382\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"55150\" data-ipsquote-contentclass=\"forums_Topic
https://wiki.sa-mp.com/wiki/AttachObjectToVehicle
 
Ezzel hogyan is kötném hozzá ?Object id helyett kocsi id-t irok ?
Cím: Jármű-Jármű összekötés
Írta: Flash - 2015. Július 14. - 02:12:34
objectid helyére egyértelmű. járműhöz meg pl:
new veh = CreateVehicle(...);
és a vehicleid helyéhez pedig így veh-t írsz.
Cím: Jármű-Jármű összekötés
Írta: Alcatraz - 2015. Július 14. - 10:40:03
Utánanéztem, és ezt kaptam: http://pro-pawn.ru/showthread.php?11329-AttachVehicleToVehicle
Nem sokat értettem belőle(mivel orosz)de a kódot azért bemásolom.
 

//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 );

 


AttachVehicleToVehicle( vehicleid, to_vehicleid, Float: offsetX, Float: offsetY, Float: offsetZ, Float: offsetA, time = 100 )
DeAttachVehicle( vehicleid )

 
\"347839be01e244708a7926a262255411.png\"
(Nem teszteltem!)
Cím: Jármű-Jármű összekötés
Írta: dodo99 - 2015. Július 14. - 12:33:06
Idézetet írta: Flash date=1436832754\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"55150\" data-ipsquote-contentclass=\"forums_Topic
objectid helyére egyértelmű. járműhöz meg pl:
new veh = CreateVehicle(...);
és a vehicleid helyéhez pedig így veh-t írsz.
 
Köszönöm. Megoldódott. Zárom