Object help. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Object help. (
/showthread.php?tid=200284)
Object help. -
[UG]Scripter - 18.12.2010
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.
Re: Object help. -
piohh - 18.12.2010
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);
Re: Object help. -
RoamPT - 18.12.2010
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);
Re: Object help. -
Grim_ - 18.12.2010
I hope you realize those are the EXACT SAME THING except it just takes up one less line.
Re: Object help. -
RoamPT - 18.12.2010
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?
Re: Object help. -
[UG]Scripter - 18.12.2010
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....
Re: Object help. -
Rac3r - 18.12.2010
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);