SA-MP Forums Archive
Problem with 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)
+--- Thread: Problem with AttachObjectToVehicle (/showthread.php?tid=349506)



Problem with AttachObjectToVehicle - Black Axe - 09.06.2012

Did it like this :


PHP код:
    Sireen CreateObject(1941910.010.010.0000);
    
CopVehicle[0] = AddStaticVehicle(477,1566.2892,-1615.8591,13.1186,270.1325,1,1); // cop car 1
    
CopVehicle[1] = AddStaticVehicle(477,1557.3464,-1615.8545,13.1397,270.2108,1,1); // cop car 2
    
CopVehicle[2] = AddStaticVehicle(477,1591.6287,-1606.2499,13.1367,180.9415,1,1); // cop car 3
    
CopVehicle[3] = AddStaticVehicle(477,1597.4304,-1606.0475,13.1902,181.4439,1,1); // cop car 4
    
CopVehicle[4] = AddStaticVehicle(477,1601.6312,-1630.6210,13.2421,91.8427,1,1); // cop car 5
    
CopVehicle[5] = AddStaticVehicle(477,1564.4960,-1631.6226,13.1129,88.9426,1,1); // cop car 6
    
for(new i=0i<sizeof(CopVehicle); i++)
    {
    
AttachObjectToVehicle(SireenCopVehicle[i],-0.039999, -0.4699990.6699990.0000000.0000000.000000);
    } 
Showing me errors saying undefined symbol Siren.. What should i do to fix it ?

The Error line in here :

PHP код:
AttachObjectToVehicle(SireenCopVehicle[i],-0.039999, -0.4699990.6699990.0000000.0000000.000000); 



Re: Problem with AttachObjectToVehicle - IstuntmanI - 09.06.2012

Add
Код:
new Sireen;
in top of script.

* You can't attach a single object to more than 1 vehicle.


Re: Problem with AttachObjectToVehicle - Black Axe - 09.06.2012

Quote:

in top of script.

* You can't attach a single object to more than 1 vehicle.

Yep - Worked , Thanks xD

but only worked for the first vehicle , How to attach it to all the vehicles ?


Re: Problem with AttachObjectToVehicle - juraska - 09.06.2012

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
* You can't attach a single object to more than 1 vehicle.
do the same thing like with vehicle


Re: Problem with AttachObjectToVehicle - calin1996 - 09.06.2012

New Sireen[MAX_VEHICLES]


Re: Problem with AttachObjectToVehicle - Black Axe - 09.06.2012

Quote:

do the same thing like with vehicle

Mhmm.. What do you mean ?


Quote:

New Sireen[MAX_VEHICLES]

Nope - giving me errors.


Re: Problem with AttachObjectToVehicle - MP2 - 09.06.2012

You need to create the object THEN attach it:

pawn Код:
CopVehicle[0] = AddStaticVehicle(477,1566.2892,-1615.8591,13.1186,270.1325,1,1); // cop car 1
CopVehicle[1] = AddStaticVehicle(477,1557.3464,-1615.8545,13.1397,270.2108,1,1); // cop car 2
CopVehicle[2] = AddStaticVehicle(477,1591.6287,-1606.2499,13.1367,180.9415,1,1); // cop car 3
CopVehicle[3] = AddStaticVehicle(477,1597.4304,-1606.0475,13.1902,181.4439,1,1); // cop car 4
CopVehicle[4] = AddStaticVehicle(477,1601.6312,-1630.6210,13.2421,91.8427,1,1); // cop car 5
CopVehicle[5] = AddStaticVehicle(477,1564.4960,-1631.6226,13.1129,88.9426,1,1); // cop car 6

new Siren;
for(new i=0; i<sizeof(CopVehicle); i++)
{
    Siren = CreateObject(19419, 10.0, 10.0, 10.0, 0, 0, 0);
    AttachObjectToVehicle(Siren, CopVehicle[i], -0.039999, -0.469999, 0.669999, 0.000000, 0.000000, 0.000000);
}
If you get errors, show the error and mark which line it is on.