SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 03/02/2015, 08:44 AM   #1
Aus
Little Clucker
 
Aus's Avatar
 
Join Date: May 2014
Location: Sydney, NSW, Australia
Posts: 21
Reputation: 0
Default Elegy/Police Lights

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 Code:
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
__________________
Aus is offline   Reply With Quote
Old 03/02/2015, 10:51 AM   #2
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,070
Reputation: 2655
Default Re: Elegy/Police Lights

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).
__________________
Vince is offline   Reply With Quote
Old 03/02/2015, 12:00 PM   #3
Aus
Little Clucker
 
Aus's Avatar
 
Join Date: May 2014
Location: Sydney, NSW, Australia
Posts: 21
Reputation: 0
Default Re: Elegy/Police Lights

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.
__________________

Last edited by Aus; 03/02/2015 at 12:04 PM. Reason: Adding more
Aus is offline   Reply With Quote
Old 03/02/2015, 02:37 PM   #4
CalvinC
High-roller
 
CalvinC's Avatar
 
Join Date: Nov 2014
Location: Denmark
Posts: 1,831
Reputation: 114
Default Re: Elegy/Police Lights

You can look up object id's in a map editor, or a website.
http://gta-sa-mp.de/forum/index.php?page=Objects
__________________
[Tutorial] Custom Playerdamage system
Desert Eagle's dealing too much damage, you want one-hit sniper kills, or damage based on body parts? Check this out.
CalvinC is offline   Reply With Quote
Old 03/02/2015, 03:01 PM   #5
Mamal75
Big Clucker
 
Join Date: Sep 2013
Posts: 66
Reputation: 2
Default Re: Elegy/Police Lights

pawn Code:
new Veh;
new Obj;
Veh = AddStaticVehicle( );
Obj = CreateObject();
AttachObjectToVehicle(Obj, Veh, );
Mamal75 is offline   Reply With Quote
Old 03/02/2015, 08:12 PM   #6
Aus
Little Clucker
 
Aus's Avatar
 
Join Date: May 2014
Location: Sydney, NSW, Australia
Posts: 21
Reputation: 0
Default Re: Elegy/Police Lights

I finally got it! Thanks guys for the help!
__________________
Aus is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GTA SA or SA-MP bug?!? [ELEGY LIGHTS] kiss Bug Reports 5 14/07/2013 11:36 PM
Police Lights John_Cooper Scripting Help 4 16/02/2012 11:56 PM
Police Lights cozza123456 Help Archive 4 26/03/2010 05:50 PM
[0.3a Fix] Police lights Matthew_Murdoch Help Archive 2 26/11/2009 12:02 PM


All times are GMT. The time now is 11:07 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.