Aller Posted March 20, 2019 Posted March 20, 2019 (edited) function toggleLightflash() local veh = getPedOccupiedVehicle(localPlayer); if (veh) then if not (getElementData(veh, "lightFlash:color")) then setElementData(veh, "lightFlash:color", (0, 0, 255), false); end local isLightFlashing = getElementData(veh, "lightFlash"); if (isLightFlashing) then setVehicleOverrideLights(veh, 0); local lightTimer = getElementData(veh, "lightFlash:timer"); killTimer(lightTimer); setElementData(veh, "lightFlash", false, false); setVehicleLightState(veh, 0, 0); setVehicleLightState(veh, 1, 0); setVehicleHeadLightColor(veh, 255, 255, 255); else setVehicleOverrideLights(veh, 2); setElementData(veh, "lightFlash:state", false, false); local lightFlashTimer = setTimer(function() local flashState = getElementData(veh, "lightFlash:state"); local lightColor = getElementData(veh, "lightFlash:color"); if (lightColor[1] == 255) then lightColor[1], lightColor[2], lightColor[3] = 0, 0, 255; else lightColor[1], lightColor[2], lightColor[3] = 255, 0, 0; end setVehicleHeadLightColor(veh, lightColor[1], lightColor[2], lightColor[3]); if (flashState) then setVehicleLightState(veh, 0, 0); setVehicleLightState(veh, 1, 1); else setVehicleLightState(veh, 0, 1); setVehicleLightState(veh, 1, 0); end setElementData(veh, "lightFlash:color", lightColor, false); setElementData(veh, "lightFlash:state", not flashState, false); end, 250, 0); setElementData(veh, "lightFlash:timer", lightFlashTimer, false); setElementData(veh, "lightFlash", true, false); end end end bindKey("l", "down", toggleLightflash); Edited March 20, 2019 by Aller 1
Moderators Patrick Posted March 20, 2019 Moderators Posted March 20, 2019 (edited) What is the problem, you don't write it down? By the way, you are copied this code from a tutorial video. (link: https://youtu.be/tQBY8U3T-es?t=8485) Then why do you need help if the solution is in that video? [HUN] Első probléma, hogy nem írtad le mit szeretnél. Honnan találjuk ki? Második, hogy ezt a kódot nem te írtad, csupán lemásoltad. Akkor miért nem abban a videóban keresed a megoldást, ahonnan másoltad? (link: https://youtu.be/tQBY8U3T-es?t=8485) Edited March 20, 2019 by stPatrick
Moderators Patrick Posted April 6, 2019 Moderators Posted April 6, 2019 5 hours ago, Aller said: Az lenne a probléma, hogy nem működik. A videóbán látszik, hogy működik. The video shows how it works.
Aller Posted April 7, 2019 Author Posted April 7, 2019 Többször is át ellenőriztem de nekem nem jó. 3-szor írtam újra és úgy sem működik. Nem tudom mi lehet a probléma.
Moderators Patrick Posted April 7, 2019 Moderators Posted April 7, 2019 (edited) 55 minutes ago, Aller said: Többször is át ellenőriztem de nekem nem jó. 3-szor írtam újra és úgy sem működik. Nem tudom mi lehet a probléma. Ez egy client oldali script, ott futtatod? És a hatodik sorban van egy hiba, amit észrevettem ránézésre. Sima zárójelet raktál kapcsos helyett. Javítás: setElementData(veh, "lightFlash:color", {0, 0, 255}, false); Edited April 7, 2019 by stPatrick
Aller Posted April 7, 2019 Author Posted April 7, 2019 Köszönöm a segítséged. Így már tökéletesen működik.
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