Where to attach objects to vehicle -
[LHT]Bally - 09.01.2012
where do i put the code because i tried putting it in and then every car i got it the object follwed me to it :S i only want it on certain static vehicles
im guessing it wouold go in my main gamemode
it also doesnt work unless i get in the car then it shows up
can someone explain where to put every bit of the code
my codes are:
pawn Code:
new object = CreateObject( 18646,0,0,0,0,0,0,80 ); // <iVO>
AttachObjectToVehicle( object, GetPlayerVehicleID(playerid), 0.370000, 0.000000, 0.679999, 0.000000, 0.000000, 0.000000 ); // <iVO>
much help apreciated
Re: Where to attach objects to vehicle -
[LHT]Bally - 09.01.2012
anyone
Re: Where to attach objects to vehicle -
SpiritEvil - 09.01.2012
pawn Code:
if (strcmp("/attachobj", cmdtext, true, 10) == 0)
{
if(!IsPlayerInAnyVehilce(playerid)) return SendClientMessage(playerid, -1, "You must be in a vehicle to use this command!");
new object = CreateObject( 18646,0,0,0,0,0,0,80 ); // <iVO>
AttachObjectToVehicle( object, GetPlayerVehicleID(playerid), 0.370000, 0.000000, 0.679999, 0.000000, 0.000000, 0.000000 ); // <iVO>
return 1;
}
This could be an example on how you could use it OnPlayerCommandText.
Re: Where to attach objects to vehicle -
[LHT]Bally - 09.01.2012
i dont want it by command i want it so certain cars that are parked up that i have assigned will get it
Re: Where to attach objects to vehicle -
SpiritEvil - 09.01.2012
Quote:
Originally Posted by [LHT]Bally
i dont want it by command i want it so certain cars that are parked up that i have assigned will get it
|
Oh okay I'll make a simple example code on how you can do it.
Re: Where to attach objects to vehicle -
IceCube! - 09.01.2012
Okay simplest way possible is to make an array with the max cars to have it
Then define these cars under OnGameMode init as such
pawn Code:
Specialcars[0] = CreaveVehicle();
Then under
public OnVehicleSpawn(vehicleid)
write
pawn Code:
public OnVehicleSpawn(vehicleid)
{
if(Specialcars == vehicleid)
{
AttachObjectToVehicle();
}
return 1;
}
NOTE: I'm not very good at explaining so anyquestions just ask and i'll answer them
Re: Where to attach objects to vehicle -
SpiritEvil - 09.01.2012
EDIT: Nevermind someone added it before me
Re: Where to attach objects to vehicle -
IceCube! - 09.01.2012
Quote:
Originally Posted by SpiritEvil
This one goes OnGameModeInt() (or OnFilterScriptInt in case it's a filterscript).
pawn Code:
new object = CreateObject( 18646,0,0,0,0,0,0,80 ); new veh1 = AddStaticVehicle(modelid, x, y, z, angle, color1, color2); // replace these to your needs new veh2 = AddStaticVehicle(modelid, x, y, z, angle, color1, color2); // replace these to your needs AttachObjectToVehicle( object, veh1, 0.370000, 0.000000, 0.679999, 0.000000, 0.000000, 0.000000 ); AttachObjectToVehicle( object, veh2, 0.370000, 0.000000, 0.679999, 0.000000, 0.000000, 0.000000 ); //repeat this for all the vehicles you want to attach this object to
|
1. Wgt make your code over and over again when you can use an array?
2. Why dont you it on vehicle spawn its more efficent i've heard.
3. Cant think of a 3...
Re: Where to attach objects to vehicle -
SpiritEvil - 09.01.2012
Well I guess your method was smarter and quicker but that was the only one I could think of at the moment.
Re: Where to attach objects to vehicle -
[LHT]Bally - 09.01.2012
anyone have teamviewer to help me ?
because my vehicles arent used like addstatic vehicle they are saved in a include
Re: Where to attach objects to vehicle -
IceCube! - 09.01.2012
Sure send me your details in a PM
Re: Where to attach objects to vehicle -
[LHT]Bally - 09.01.2012
pmed