SA-MP Forums Archive
Permanent 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: Permanent AttachObjectToVehicle? (/showthread.php?tid=418454)



Permanent AttachObjectToVehicle? - needhack - 24.02.2013

I used iVO to attach objects to vehicles in game and obviously save them in scriptfiles.
Now my question is, is there any way to permanently keep an object on a vehicle that is in your server?
So basically when the server starts the object is already attached to the car.
If this is possible, how?


Re: Permanent AttachObjectToVehicle? - Lemonaidz - 25.02.2013

Mabye try putting it under:
public OnGameModeInit()
Like this:
it should work.

public OnGameModeInit()
{
SetPVarInt(playerid, "item1", CreateObject(2099,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "item1"), GetPlayerVehicleID(playerid),-0.000000, 2.345006, -0.279999, 0.000000, 0.000000, 0.000000);
}


Re: Permanent AttachObjectToVehicle? - Lemonaidz - 25.02.2013

Also try adding you vehicle in that code above like:

AddStaticVehicle (your vehicle)


Re: Permanent AttachObjectToVehicle? - JamesWilliams - 25.02.2013

And next time put it into a Pawn Code
Код:
 public OnGameModeInit()
{ 
SetPVarInt(playerid, "item1", CreateObject(2099,0,0,0,0,0,0));
AttachObjectToVehicle(GetPVarInt(playerid, "item1"), GetPlayerVehicleID(playerid),-0.000000, 2.345006, -0.279999, 0.000000, 0.000000, 0.000000);
}



Re: Permanent AttachObjectToVehicle? - needhack - 25.02.2013

That just makes Pawno crash.
Maybe I didn't explain correctly.
I have a basic Admiral placed with AddStaticVehicle.
Now I just want the saved object which I have the coords from to permanently be on that Admiral, how?