Noneatme Posted October 22, 2011 Posted October 22, 2011 (edited) Hi there, at first, sorry for my bad english. I use more pictures than text, for better understanding So, Ive made a simple script: you can toggle the lights on/off with the command /lights and heres the code: local lamp0 = nil local lamp1 = nil local lamp2 = nil local lamp3 = nil local lamp4 = nil local lamp5 = nil function vanlights ( source, commandName ) local x, y, z = getElementPosition ( source ) if ( isPedInVehicle ( source ) ) then local vehicle = getPedOccupiedVehicle ( source ) if ( getVehicleController ( vehicle ) == source ) then local id = getElementModel ( vehicle ) if ( ( id == 582 )) then local state = getElementData( vehicle, "tempdata.lights" ) --outputChatBox( "Test") if not getElementData( vehicle, "tempdata.lights" ) then --outputChatBox( "Test") lamp0 = createObject ( 1215, 0, 0, 0 ) lamp1 = createObject ( 1215, 0, 0, 0 ) lamp2 = createObject ( 1215, 0, 0, 0 ) lamp3 = createObject ( 1215, 0, 0, 0 ) lamp4 = createObject ( 1215, 0, 0, 0 ) lamp5 = createObject ( 1215, 0, 0, 0 ) setObjectScale ( lamp0, 0.5 ) setObjectScale ( lamp1, 0.5 ) setObjectScale ( lamp2, 0.5 ) setObjectScale ( lamp3, 0.5 ) setObjectScale ( lamp4, 0.5 ) setObjectScale ( lamp5, 0.5 ) --attachElements ( lamp0, vehicle, 0.87, -3.25, 0 ) --attachElements ( lamp1, vehicle, -0.87, -3.25, 0 ) attachElements ( lamp2, vehicle, 0.7, -1.3, 0.85 ) attachElements ( lamp3, vehicle, 0.7, -2.7, 0.85 ) attachElements ( lamp4, vehicle, -0.75, -2.7, 0.85 ) attachElements ( lamp5, vehicle, -0.75, -1.3, 0.85 ) setElementData( vehicle, "tempdata.lights", 1 ) elseif state == 1 then destroyElement ( lamp0 ) destroyElement ( lamp1 ) destroyElement ( lamp2 ) destroyElement ( lamp3 ) destroyElement ( lamp4 ) destroyElement ( lamp5 ) setElementData( vehicle, "tempdata.lights", nil ) end end end end end and my problem is this: (If the lights of van 1 and 2 toggled I can't turn the lights of van 1 off.(amazing english)) I hope some1 can help me... so, thanks for your help. /Help me please Edited October 26, 2011 by Guest
karlis Posted October 26, 2011 Posted October 26, 2011 you need to define the lamp for each vehicle lamp1={} lamp1[vehicle]=... and so on also, remove "local state= ..." line its not needed and change "elseif ..." line to just "else" and whats the point of getting x,y,z of player? [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
karlis Posted October 26, 2011 Posted October 26, 2011 np, im here to help [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now