SA-MP Forums Archive
AttachObjectToVehicle - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: AttachObjectToVehicle (/showthread.php?tid=277939)



AttachObjectToVehicle - cruising - 20.08.2011

Hello!

Im trying to add some rockets to rustler, but its not going so good.

i have created the objects:
pawn Код:
CreateObject( 3790,0,0,0,0,0,0,80 ); // Rustler Rocket
    CreateObject( 3790,0,0,0,0,0,0,80 ); // Rustler Rocket
    CreateObject( 3790,0,0,0,0,0,0,80 ); // Rustler Rocket
    CreateObject( 3790,0,0,0,0,0,0,80 ); // Rustler Rocket
    CreateObject( 3790,0,0,0,0,0,0,80 ); // Rustler Rocket
    CreateObject( 3790,0,0,0,0,0,0,80 ); // Rustler Rocket
And how about AttachObjectToVehicle? put it on OnGameModeInit? that didnt get the rockets in game,
even not with this cmd
pawn Код:
COMMAND:load(objectid, vehicleid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:RotZ, params[])
{
    AttachObjectToVehicle(3790, 476, 2.200000, 1.700000, -1.000000, 93.000000, 271.000000, 0.000000 ); // Rustler Rocket
    AttachObjectToVehicle(3790, 476, 2.699999, 1.700000, -0.899999, 0.000000, 2.000000, 270.000000 ); // Rustler Rocket
    AttachObjectToVehicle(3790, 476, 3.269999, 1.660000, -0.820000, 0.000000, 2.000000, 271.699890 ); // Rustler Rocket
    AttachObjectToVehicle(3790, 476, -2.040000, 1.710000, -1.000000, 0.000000, 1.700000, 270.000000 ); // Rustler Rocket
    AttachObjectToVehicle(3790, 476, -2.629999, 1.700000, -0.949999, 0.000000, 1.600000, 269.000000 ); // Rustler Rocket
    AttachObjectToVehicle(3790, 476, -3.209999, 1.700000, -0.830000, 0.000000, 1.000000, 268.700012 ); // Rustler Rocket
    return 1;
}
So, what to do to make it right?


Re: AttachObjectToVehicle - =WoR=G4M3Ov3r - 20.08.2011

Is it giving you any errors ?, and paste it under OnPlayerCommandText


Re: AttachObjectToVehicle - cruising - 20.08.2011

Quote:
Originally Posted by BATAD
Посмотреть сообщение
Is it giving you any errors ?, and paste it under OnPlayerCommandText
It gives no errors, and why under OnPlayerCommandText? always when i put i cmd there, it tells me "unknown command"


Re: AttachObjectToVehicle - Machida - 20.08.2011

new Something;
Something = CreateObject( 3790,0,0,0,0,0,0,80 );
AttachObjectToVehicle(something,...,..,.....)
I guess.


Re: AttachObjectToVehicle - cruising - 20.08.2011

Quote:
Originally Posted by Machida
Посмотреть сообщение
new Something;
Something = CreateObject( 3790,0,0,0,0,0,0,80 );
AttachObjectToVehicle(something,...,..,.....)
I guess.
Yeah, but when i put ""new object = CreateObject( 3790,0,0,0,0,0,0,80 );"" pawno crash


Re: AttachObjectToVehicle - Machida - 20.08.2011

do:
new object;
object = ....


Re: AttachObjectToVehicle - =WoR=G4M3Ov3r - 20.08.2011

Quote:
Originally Posted by cruising
Посмотреть сообщение
Yeah, but when i put ""new object = CreateObject( 3790,0,0,0,0,0,0,80 );"" pawno crash
PHP код:
new object;
object AttachObjectToVehicle(objectidvehicleidFloat:fOffsetXFloat:fOffsetYFloat:fOffsetZFloat:fRotXFloat:fRotYFloat:RotZ
https://sampwiki.blast.hk/wiki/AttachObjectToVehicle


Re: AttachObjectToVehicle - cruising - 20.08.2011

I have read the wiki, but it didnt work.

Now i have made like this, but still not working :S
EDIT:
pawn Код:
new rocket;

public OnGameModeInit()
{
    AttachObjectToVehicle(rocket, 476, 2.200000, 1.700000, -1.000000, 93.000000, 271.000000, 0.000000 ); // Rustler Rocket
    AttachObjectToVehicle(rocket, 476, 2.699999, 1.700000, -0.899999, 0.000000, 2.000000, 270.000000 ); // Rustler Rocket
    AttachObjectToVehicle(rocket, 476, 3.269999, 1.660000, -0.820000, 0.000000, 2.000000, 271.699890 ); // Rustler Rocket
    AttachObjectToVehicle(rocket, 476, -2.040000, 1.710000, -1.000000, 0.000000, 1.700000, 270.000000 ); // Rustler Rocket
    AttachObjectToVehicle(rocket, 476, -2.629999, 1.700000, -0.949999, 0.000000, 1.600000, 269.000000 ); // Rustler Rocket
    AttachObjectToVehicle(rocket, 476, -3.209999, 1.700000, -0.830000, 0.000000, 1.000000, 268.700012 ); // Rustler Rocket
    rocket = CreateObject( 3790,0,0,0,0,0,0,80 ); // <iVO>
    rocket = CreateObject( 3790,0,0,0,0,0,0,80 ); // <iVO>
    rocket = CreateObject( 3790,0,0,0,0,0,0,80 ); // <iVO>
    rocket = CreateObject( 3790,0,0,0,0,0,0,80 ); // <iVO>
    rocket = CreateObject( 3790,0,0,0,0,0,0,80 ); // <iVO>
    rocket = CreateObject( 3790,0,0,0,0,0,0,80 ); // <iVO>  
    return 1;
}

//and also a cmd
COMMAND:load(objectid, vehicleid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:RotZ, params[])
{
    AttachObjectToVehicle(rocket, 476, 2.200000, 1.700000, -1.000000, 93.000000, 271.000000, 0.000000 ); // Rustler Rocket
    AttachObjectToVehicle(rocket, 476, 2.699999, 1.700000, -0.899999, 0.000000, 2.000000, 270.000000 ); // Rustler Rocket
    AttachObjectToVehicle(rocket, 476, 3.269999, 1.660000, -0.820000, 0.000000, 2.000000, 271.699890 ); // Rustler Rocket
    AttachObjectToVehicle(rocket, 476, -2.040000, 1.710000, -1.000000, 0.000000, 1.700000, 270.000000 ); // Rustler Rocket
    AttachObjectToVehicle(rocket, 476, -2.629999, 1.700000, -0.949999, 0.000000, 1.600000, 269.000000 ); // Rustler Rocket
    AttachObjectToVehicle(rocket, 476, -3.209999, 1.700000, -0.830000, 0.000000, 1.000000, 268.700012 ); // Rustler Rocket
    return 1;
}