SA-MP Forums Archive
need help 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: need help with AttachObjectToVehicle (/showthread.php?tid=555314)



need help with AttachObjectToVehicle - cyberlord - 07.01.2015

Hello i want to attach fire object on vehicle when vehicle healt reach 250 hare is my code :

Код:
Flame = CreateObject(18690, 10.0, 10.0, 10.0, 0, 0, 0);

public carcheck()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
           new vehicle, Float:health;
           vehicle = GetPlayerVehicleID(i);
           GetVehicleHealth(vehicle, health);
           if(health <= 250)
           {
           		RemovePlayerFromVehicle(i);
           		AttachObjectToVehicle(Flame, vehicle, 0.0, 1.5, -1.5, 0.000000, 0.000000, 0.000000);
             	health += 150;
                SetVehicleHealth(vehicle, health);
   
           }
     }
     return 1;
}
but its not working and i dont realy know the reason why , i have tested this on game mode int
Код:
test = AddStaticVehicle(411, 1798.6711,-1605.2622,13.5469,260.7245, 1, 1);
Flame = CreateObject(18690, 10.0, 10.0, 10.0, 0, 0, 0);
AttachObjectToVehicle(Flame, test, 0.0, 1.5, -1.5, 0.000000, 0.000000, 0.000000);
yes its works its attach flames to vehicle but if i do that on my carcheck its not working its just add +150 healt to vehicle when she reach 250 . help please


Re: need help with AttachObjectToVehicle - Pottus - 07.01.2015

You need an object for each vehicle so CreateObject() is a bad choice I recommend using CreateDynamicObject()


Re: need help with AttachObjectToVehicle - cyberlord - 07.01.2015

Quote:
Originally Posted by Pottus
Посмотреть сообщение
You need an object for each vehicle so CreateObject() is a bad choice I recommend using CreateDynamicObject()
yes tnx u but this doesnt help i remake my object to dynamic one but its still not attach them

and another thing if i use dynamic object i got this instead of flames




Re: need help with AttachObjectToVehicle - cyberlord - 07.01.2015

Please help my some1