Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Warnlicht-Script der Emergencyautos. Beinhaltet (Models):
- [523, 598, 596, 597, 599] & [416, 407, 544]
- © 2011 by JK Exposure]]
- local policecars = { 523, 598, 596, 597, 599 }
- local emergencycars = { 416, 407, 544 }
- local usedcars = {}
- local timers = {}
- local checked, internmodel = true, false
- function check( typ, car )
- local typ = "nothing"
- for y,z in ipairs( usedcars ) do
- if z == source then
- typ = "existing"
- end
- end
- if typ == "nothing" then
- for a,b in ipairs( policecars ) do
- if typ == "nothing" then
- if getElementModel( source ) == b then
- typ = "police"
- else
- typ = "nothing"
- end
- end
- end
- if typ == "nothing" then
- for c,d in ipairs( emergencycars ) do
- if typ == "nothing" then
- if getElementModel( source ) == d then
- typ = "ambulance"
- else
- typ = "nothing"
- end
- end
- end
- end
- if typ == "ambulance" or typ == "police" then
- local car = source
- table.insert( usedcars, source )
- colorisation( typ, car )
- timers[car] = setTimer( colorisation, 600, 0, typ, car )
- typ = "nothing"
- end
- end
- end
- function colorisation( typ, car )
- if typ == "police" then
- internmodel = true
- elseif typ == "ambulance" then
- internmodel = false
- end
- if isElement( car ) and not isVehicleBlown( car ) then
- if getVehicleSirensOn( car ) then
- local red, green, blue = getVehicleHeadLightColor( car )
- local lightstate = getVehicleOverrideLights( car )
- if internmodel then
- if red == 255 then
- setVehicleHeadLightColor( car, 0, 0, 255 )
- setVehicleLightState( car, 2, 0 )
- setVehicleLightState( car, 3, 1 )
- else
- setVehicleHeadLightColor( car, 255, 0, 0 )
- setVehicleLightState( car, 2, 1 )
- setVehicleLightState( car, 3, 0 )
- end
- else
- if green == 255 then
- setVehicleHeadLightColor( car, 255, 0, 0 )
- setVehicleLightState( car, 2, 0 )
- setVehicleLightState( car, 3, 1 )
- else
- setVehicleHeadLightColor( car, 255, 255, 255 )
- setVehicleLightState( car, 2, 1 )
- setVehicleLightState( car, 3, 0 )
- end
- end
- checked = false
- if lightstate ~= 2 then
- setVehicleOverrideLights( car, 2 )
- end
- else
- setVehicleHeadLightColor( car, 255, 255, 255 )
- setVehicleLightState( car, 2, 0 )
- setVehicleLightState( car, 3, 0 )
- if not checked then
- local hour, mins = getTime()
- if hour > 18 or hour < 8 then
- setVehicleOverrideLights( car, 2 )
- else
- setVehicleOverrideLights( car, 1 )
- end
- end
- checked = true
- end
- else
- table.remove( usedcars, y )
- killTimer( timers[car] )
- end
- end
- addEventHandler( "onVehicleEnter", getRootElement(), check )
- -- FINISHED SCRIPT [17:37, 06.12.11]
Add Comment
Please, Sign In to add comment