Elegy/Police Lights
#1

I'm trying to attach police lights to the roof of a car in my server, I'm pretty sure I'm doing everything correct but it doesn't seem to work. :/
If someone could help me that would be greatly appreciated! Will rep if you can help me

PHP код:
AddStaticVehicleEx(562,1295.4215,-984.8573,32.3540,91.0700,1,1,500);
SetVehicleNumberPlate(20,"Ohh Shit");
AttachObjectToVehicle(19419,20,0,0,0,0,0,0);
AddVehicleComponent(20,1172);
AddVehicleComponent(20,1026);
AddVehicleComponent(20,1027); 
Cheers! -Aus
Reply
#2

This isn't how it works. You need to attach the objectid, not a modelid. That means that the objects has to be created first. Secondly, you should really assign your vehicleids to a variable as well. Relying on assumptions (i.e. assuming that the vehicle will always have id 20 is considered shoddy coding). And lastly 0,0,0 denotes the center of the floor of the car. The object will not magically adjust to your desired position. You will probably want to move it up first (increase Z a bit), then a bit forward (increase Y a bit) and perhaps a bit the left (decrease X a bit).
Reply
#3

Thanks Vince. I'll have a look into it again and use your advice. I have to admit my coding is extremely crappy. Only new to it.

Just curious, how would I get the object ID of that model :/

Sorry for any inconvenience.
Reply
#4

You can look up object id's in a map editor, or a website.
http://gta-sa-mp.de/forum/index.php?page=Objects
Reply
#5

pawn Код:
new Veh;
new Obj;
Veh = AddStaticVehicle();
Obj = CreateObject();
AttachObjectToVehicle(Obj, Veh, ……);
Reply
#6

I finally got it! Thanks guys for the help!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)