Search the Community
Showing results for tags 'disco lights'.
-
The console pops up: WARNING: discoswiatla/server.lua:26: Bad argument @ 'setVehicleHeadLightColor' [Expected vehicle at argument 1] server.lua: local discoTimer = {} local discoState = {} function vehicleLights( player, command, lig1, lig2, lig3 ) lig1 = lig1 or math.random( 0, 255 ) lig2 = lig2 or math.random( 0, 255 ) lig3 = lig3 or math.random( 0, 255 ) local vehicle = getPedOccupiedVehicle( player ) if ( vehicle ) then setVehicleHeadLightColor( vehicle, lig1, lig2, lig3 ) outputChatBox("Your Car Have now another Light!", player, 0, 255, 0 ) else outputChatBox("you must have a vehicle for doing this!", player, 255, 0, 0 ) end end addCommandHandler("lights",vehicleLights) -- Change your VehicleLights function Disco(player,command) local vehicle = getPedOccupiedVehicle(player) if (vehicle) then if discoState[player] == false then discoState[player] = true discoTimer[player] = setTimer( function ( playerVehicle ) setVehicleHeadLightColor( playerVehicle, math.random(0,255), math.random(0,255), math.random(0,255) ) end , 100, 0, vehicle ) outputChatBox( "!!Disco-Fever!!", player, 0, 255, 0 ) else if discoTimer[player] then killTimer( discoTimer[player] ) discoTimer[player] = nil discoState[player] = false setVehicleHeadLightColor( vehicle, 255, 255, 255 ) end end else outputChatBox( "!!You have to sit in a Car/Bike!!", player, 255, 0, 0 ) end end addCommandHandler("disco",Disco)--Disco ((((:)))) function reset(player, command ) local vehicle = getPedOccupiedVehicle(player) local r,g,b = getVehicleHeadLightColor(vehicle) if (vehicle) then if not (r==255) and not (g==255) and not (b==255) then setVehicleHeadLightColor( vehicle, 255,255,255) end end end addCommandHandler("reset",reset) function setStateOnStart() for _, players in ipairs( getElementsByType( "player" ) ) do discoState[players] = false end end addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), setStateOnStart ); function setStateOnJoin() discoState[source] = false end addEventHandler( "onPlayerJoin", getRootElement(), setStateOnJoin ) function removeStateOnQuit() discoState[source] = nil end addEventHandler( "onPlayerQuit", getRootElement(), setStateOnJoin )