gyrosos14 Posted December 9, 2021 Share Posted December 9, 2021 Kliens oldal: 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] = 0, 255; else lightColor[1], lightColor[2] = 255, 0; end setVehicleHeadLightColor(veh, lightColor[1], 0, lightColor[2]); 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, 150, 0); setElementData(veh, "lightFlash:timer", lightFlashTimer, false); setElementData(veh, "lightFlash", true, false); end end end bindKey("z", "down", toggleLightflash); local x, y = guiGetScreenSize(); local relX, relY = x/1280, y/720; addEvent("drawSirenPanel", true); addEventHandler("drawSirenPanel", localPlayer, function() -- Sziréna típusok : 1 - Tűzoltó 2 - Egyéb megkülönböztető j. haszn. járm. local drawHud = false; if (drawHud) then drawHud = false; else drawHud = true; end if (drawHud) then dxDrawRectangle(x*0.5, y*0.5, relX*200, relY*50, tocolor(0, 0, 0, 150) ); dxDrawText("LoyalMTA - Sziréna panel",x*0.5, y*0.5, x*0.65625, y*0.435, tocolor(255, 255, 255, 255), 1, "arial", "center", "center"); else end end ); Szerver oldal: emergencyVehicles = {[416]=true, [596]=true, [598]=true, [597]=true, [599]=true, [407]=true, [544]=true}; -- Megkülönböztető jelzést használó járművek addEventHandler("onVehicleEnter", root, function(player, seat) vehicle = getPedOccupiedVehicle(player); -- Lekéri a járművet, melybe a player beszállt removeVehicleSirens(vehicle); -- Eltünteti a szirénát a járműről if (removeVehicleSirens) then outputDebugString("[VEHICLE] Sikeres sziréna törlés!", 3); -- Sikeres sziréna törlés else outputDebugString("[ERROR] Sikertelen sziréna törlés!", 1); -- Sikertelen sziréna törlés end if (emergencyVehicles[getElementModel(source)] and seat < 2) then -- Ha a getElementModel emergency jármű ID-jét adja vissza és az ülés az első 2 akkor triggerClientEvent(player, "drawSirenPanel", player); end end ); Link to comment
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