Object help.
#1

Hey,

Basicly Im having an issue using the AttachObject to vehicle Function....

Heres My Code:

pawn Код:
new light1 = CreateObject(18646, 0, 0, 0, 0, 0, 0);

    AttachObjectToVehicle(light1,28,0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
//                             carid x   y     z     rx   ry   rz

When In game I dont see the object on this vehicle am I doing something wrong or what.... I counted the AddStaticVehicleEx's and got this car as 28 ... Yet it does not show up....


Any Ideas.
Reply
#2

Quote:
Originally Posted by [UG]Scripter
Посмотреть сообщение
Hey,

Basicly Im having an issue using the AttachObject to vehicle Function....

Any Ideas.
pawn Код:
Code:

    new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    light1[playerid] = CreateObject(18646, 0, 0, 0, 0, 0, 0);
    AttachObjectToVehicle(light1,vehicle,0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
Reply
#3

Quote:
Originally Posted by piohh
Посмотреть сообщение
pawn Код:
Code:

    new vehicle;
    vehicle = GetPlayerVehicleID(playerid);
    light1[playerid] = CreateObject(18646, 0, 0, 0, 0, 0, 0);
    AttachObjectToVehicle(light1,vehicle,0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
No need to define vehicle and then vehicle = GetPlayerVehicleID(playerid) again, you can simply use new vehicle = GetPlayerVehicleID(playerid);

So:

pawn Код:
new vehicle = GetPlayerVehicleID(playerid);
    light1[playerid] = CreateObject(18646, 0, 0, 0, 0, 0, 0);
    AttachObjectToVehicle(light1,vehicle,0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
Reply
#4

I hope you realize those are the EXACT SAME THING except it just takes up one less line.
Reply
#5

Quote:
Originally Posted by Grim_
Посмотреть сообщение
I hope you realize those are the EXACT SAME THING except it just takes up one less line.
Didn't realize that, jeez i'm so dumb.

Quote:

No need to define vehicle and then vehicle = GetPlayerVehicleID(playerid) again, you can simply use new vehicle = GetPlayerVehicleID(playerid);

Did you got what i meant?
Reply
#6

Okay,..... Basicly what I was aiming for way. This object would be attached to a SPECIFIC vehicle.. not every vehicle a player gets in... Imagine ever car looking like an undercover police car....
Reply
#7

I'm not saying you counted wrong at all, but it might be more reliable if you tag the car when it's created. Otherthan that, your code looks perfect.
Код:
new PoliceCar;
new PoliceLight;
Код:
PoliceCar = CreateVehicle(...... // I don't know your CreateVehicle/AddStaticVehicle line)
PoliceLight = CreateObject(18646, 0, 0, 0, 0, 0, 0);
AttachObjectToVehicle(PoliceLight, PoliceCar, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)