Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-11-14, 18:14


Wydra







Wiek: 25
Na forum: 2207 dni
Posty: 10
Nick w MP: Xsardnes



Respekt: 50

Cze?c, Potrzebuje ogarn?c skrypt na panel sygna?k?w dla SAPD pod gm pystories - aby mog?a panelu uzywac tylko i wy?acznie frakcja SAPD, m?g?by kto? mi po krotce rozpisac jak to zrobic etc.?

[ Dodano: 2020-11-14, 18:20 ]
[link] https://gtao.pl/122976.htm [/link] z tego skryptu korzystam

[ Dodano: 2020-11-14, 18:30 ]
+aby m?c to zablokowa? na wybrane pojazdy (ID)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-14, 18:51


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Aby zrobi? restrykcje w skrypcie musisz si? zorientowa? jak nadajesz przywileje: element data czy np. w skrypcie masz gotow? funkcj? do sprawdzania posady gracza.

Je?li to pierwsze, to wystarczy prosty warunek z funkcj?

Więcej informacji znajdziesz w Wikipedii MTA:

getElementData


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-14, 19:04


Wydra







Wiek: 25
Na forum: 2207 dni
Posty: 10
Nick w MP: Xsardnes



Respekt: 50

Pro?ciej? M?g?by? mi jako? to pokaza? jak to mniej wi?cej zrobi?, co Z czym?

[ Dodano: 2020-11-14, 19:05 ]
Lub poprostu mi to jako? napisa? poprostu

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-14, 19:20


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Pro?ciej si? nie da.
Jak wykona? prosty warunek sprawdzaj?cy?

if getElementData(zmienna_gracza"klucz_element_daty"then
   -- kod
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-14, 19:23


Wydra







Wiek: 25
Na forum: 2207 dni
Posty: 10
Nick w MP: Xsardnes



Respekt: 50

Czyli wystarczy ?e wkleje to Po stronie serwera I klucz zamieni? na np. Pystories_core?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-14, 19:25


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

No musisz warunek na takim przyk?adzie wykona? w panelu o?wietlenia, kt?ry chcesz zablokowa? dla danej grupy os?b. Chyba nie do ko?ca nawet wiesz co chcesz zrobi?.
Klucz taki, jakim okre?lasz cz?onk?w grupy SAPD w element dacie/.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-14, 19:37


Wydra







Wiek: 25
Na forum: 2207 dni
Posty: 10
Nick w MP: Xsardnes



Respekt: 50

 if getElementData(pystories_core"SAPD"then
   -- kod
end



Tak b?dzie git czy nie dobrze co??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-14, 19:48


Maniekxx

Amator






Wiek: 24
Na forum: 2894 dni
Posty: 232
Nick w MP: Maniekxx

Piwa: 225

Respekt: 110
Respekt: 110

Ostrzeżeń: 20%
Je?li ten skrypt jest po stronie klienta to zr?b:


 if getElementData(localPlayer"SAPD"then
   -- kod
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-14, 19:49


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Jesli pod tak? zmienn? masz gracza to okej.
W miejscu -- kod masz wstawi? ten kod, kt?ry ma by? zablokowany dla SAPD

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-14, 19:51


Wydra







Wiek: 25
Na forum: 2207 dni
Posty: 10
Nick w MP: Xsardnes



Respekt: 50

Strona serwera
 --[[
Skrypt zostawykonany przez vNeXxuS.
Zakazuje siusuwania tej notatki o autorze.
Osoba kt?ra pobra?a dany skrypt ma tylko i wy??cznie prawa do:
    * Korzystania z skryptu
]]

addEvent("checkSiren"true)
addEventHandler("checkSiren"root, function()
    triggerClientEvent(root"toggleSiren"root)
end)

addEvent("firstLights"true)
addEventHandler("firstLights"root, function()
    local vehicle getPedOccupiedVehicle(client)
    if not getElementData(vehicle"lightsStatus") == true then
        setElementData(vehicle"lightsStatus"true)
        timer setTimer(function()
            if not getElementData(vehicle"lightsLeft") == true then
                setElementData(vehicle"lightsLeft"true)
                setVehicleLightState(vehicle11)
                setVehicleLightState(vehicle00)
                setVehicleLightState(vehicle30)
                setVehicleLightState(vehicle20)
                setVehicleHeadLightColor(vehicle25500)
            elseif getElementData(vehicle"lightsLeft") == true then
                setElementData(vehicle"lightsLeft"false)
                setVehicleLightState(vehicle01)
                setVehicleLightState(vehicle10)
                setVehicleLightState(vehicle30)
                setVehicleLightState(vehicle20)
                setVehicleHeadLightColor(vehicle66134244)
            end
        end1350)
    elseif getElementData(vehicle"lightsStatus") == true then
        setElementData(vehicle"lightsStatus"false)
        killTimer(timer)
        setVehicleHeadLightColor(vehicle255255255)
        setVehicleLightState(vehicle00)
        setVehicleLightState(vehicle10)
        setVehicleLightState(vehicle30)
        setVehicleLightState(vehicle20)
    end
end)

addEvent("secondLights"true)
addEventHandler("secondLights"root, function()
    local vehicle getPedOccupiedVehicle(client)
    if not getElementData(vehicle"lightsStatus") == true then
        setElementData(vehicle"lightsStatus"true)
        timer setTimer(function()
            if not getElementData(vehicle"lightsLeft") == true then
                setElementData(vehicle"lightsLeft"true)
                setVehicleLightState(vehicle11)
                setVehicleLightState(vehicle00)
                setVehicleLightState(vehicle30)
                setVehicleLightState(vehicle20)
                setVehicleHeadLightColor(vehicle255255255)
            elseif getElementData(vehicle"lightsLeft") == true then
                setElementData(vehicle"lightsLeft"false)
                setVehicleLightState(vehicle01)
                setVehicleLightState(vehicle10)
                setVehicleLightState(vehicle30)
                setVehicleLightState(vehicle20)
                setVehicleHeadLightColor(vehicle255255255)
            end
        end1600)
    elseif getElementData(vehicle"lightsStatus") == true then
        setElementData(vehicle"lightsStatus"false)
        killTimer(timer)
        setVehicleHeadLightColor(vehicle255255255)
        setVehicleLightState(vehicle00)
        setVehicleLightState(vehicle10)
        setVehicleLightState(vehicle30)
        setVehicleLightState(vehicle20)
    end
end)

addEvent("thirdLights"true)
addEventHandler("thirdLights"root, function()
    local vehicle getPedOccupiedVehicle(client)
    if not getElementData(vehicle"lightsStatus") == true then
        setElementData(vehicle"lightsStatus"true)
        timer setTimer(function()
            if not getElementData(vehicle"lightsLeft") == true then
                setElementData(vehicle"lightsLeft"true)
                setVehicleLightState(vehicle10)
                setVehicleLightState(vehicle00)
                setVehicleLightState(vehicle30)
                setVehicleLightState(vehicle20)
                setVehicleHeadLightColor(vehicle25500)
            elseif getElementData(vehicle"lightsLeft") == true then
                setElementData(vehicle"lightsLeft"false)
                setVehicleLightState(vehicle00)
                setVehicleLightState(vehicle10)
                setVehicleLightState(vehicle30)
                setVehicleLightState(vehicle20)
                setVehicleHeadLightColor(vehicle66134244)
            end
        end3000)
    elseif getElementData(vehicle"lightsStatus") == true then
        setElementData(vehicle"lightsStatus"false)
        killTimer(timer)
        setVehicleHeadLightColor(vehicle255255255)
        setVehicleLightState(vehicle00)
        setVehicleLightState(vehicle10)
        setVehicleLightState(vehicle30)
        setVehicleLightState(vehicle20)
    end
end)

addEvent("toggleBelt"true)
addEventHandler("toggleBelt"root, function()
    local vehicle getPedOccupiedVehicle(client)
    local x,y,getElementPosition(vehicle)
    if not getElementData(vehicle"lightsStatus") == true then
        setElementData(vehicle"lightsStatus"true)
        belt createObject(953x,y,z)
        attachElements(beltvehicle0.20, -0.1)
        removeVehicleSirens(vehicle)
        addVehicleSirens(vehicle42truefalsetruetrue)
        setVehicleSirens(vehicle10.60.20.800255132.6132.6)
        setVehicleSirens(vehicle2000000200200)
        setVehicleSirens(vehicle3000000200200)
        setVehicleSirens(vehicle4000000200200)
    elseif getElementData(vehicle"lightsStatus") == true then
        setElementData(vehicle"lightsStatus"false)
        destroyElement(belt)
        removeVehicleSirens(vehicle)
    end
end



Strona Clienta

 --[[
Skrypt zostawykonany przez vNeXxuS.
Zakazuje siusuwania tej notatki o autorze.
Osoba kt?ra pobra?a dany skrypt ma tylko i wy??cznie prawa do:
    * Korzystania z skryptu
]]

local screenWscreenH guiGetScreenSize()

dff engineLoadDFF("kogut.dff")
engineReplaceModel(dff953)

addEvent("toggleSiren"true)
addEventHandler("toggleSiren"root, function()
    if getPedOccupiedVehicle(localPlayerthen
        local vehicle getPedOccupiedVehicle(localPlayer)
        if not getElementData(vehicle"sirenStatus") == true then
            setElementData(vehicle"sirenStatus"true)
            local x,y,getElementPosition(vehicle)
            siren playSound3D("/sounds/siren.mp3"x,y,ztrue)
            setSoundVolume(siren0.8)
            setSoundMaxDistance(siren100)
            attachElements(sirenvehicle000)
        elseif getElementData(vehicle"sirenStatus") == true then
            setElementData(vehicle"sirenStatus"false)
            destroyElement(siren)
        end
    end
end)

function dxDraw()
    dxDrawRectangle(screenW 0.8016screenH 0.2852screenW 0.1276screenH 0.2926tocolor(100200), false)
    dxDrawRectangle(screenW 0.8016screenH 0.5778screenW 0.1276screenH 0.0046tocolor(22900200), false)
    dxDrawRectangle(screenW 0.8016screenH 0.2852screenW 0.1276screenH 0.0139tocolor(22900200), false)
    dxDrawText("System O?wietlenia (O)"screenW 0.8016screenH 0.2852screenW 0.9292screenH 0.2991tocolor(255255255255), 0.85"default-bold""center""center"falsefalsefalsefalsefalse)
    dxDrawText("Panel Sygnalizajci ?wietlenj \nKogut tylko dla nieoznakowanych"screenW 0.8063screenH 0.4185screenW 0.9240screenH 0.4667tocolor(255255255255), 0.76"clear""left""top"falsefalsefalsefalsefalse)
    
    dxDrawRectangle(screenW 0.8042screenH 0.3046screenW 0.1219screenH 0.0148tocolor(25500255), false)
    dxDrawRectangle(screenW 0.8042screenH 0.3287screenW 0.1219screenH 0.0148tocolor(25500255), false)
    dxDrawRectangle(screenW 0.8042screenH 0.3528screenW 0.1219screenH 0.0148tocolor(25500255), false)
    dxDrawRectangle(screenW 0.8042screenH 0.3769screenW 0.1219screenH 0.0148tocolor(25500255), false)
    dxDrawRectangle(screenW 0.8042screenH 0.5528screenW 0.1219screenH 0.0148tocolor(25500255), false)
    dxDrawText("?wiat?a Alarmowe"screenW 0.8036screenH 0.3046screenW 0.9260screenH 0.3194tocolor(255255255255), 1"clear""center""center"falsefalsefalsefalsefalse)
    dxDrawText("Bia?e ?wiat?a Alarmowe"screenW 0.8042screenH 0.3287screenW 0.9266screenH 0.3435tocolor(255255255255), 1"clear""center""center"falsefalsefalsefalsefalse)
    dxDrawText("?wiat?a Ostrzegawcze"screenW 0.8042screenH 0.3528screenW 0.9266screenH 0.3676tocolor(255255255255), 1"clear""center""center"falsefalsefalsefalsefalse)
    dxDrawText("Kogut*"screenW 0.8042screenH 0.3769screenW 0.9266screenH 0.3917tocolor(255255255255), 1"clear""center""center"falsefalsefalsefalsefalse)
    dxDrawText("Syrena"screenW 0.8042screenH 0.5528screenW 0.9266screenH 0.5676tocolor(255255255255), 1"clear""center""center"falsefalsefalsefalsefalse)
end

function mousePosition(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*screenW,cy*screenH
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

function openClose()
    if getElementData(localPlayer"systemos:open") == true then
        showCursor(false)
        removeEventHandler("onClientRender"getRootElement(), dxDraw)
        setElementData(localPlayer"systemos:open"false)
    elseif not getElementData(localPlayer"systemos:open") == true then
        if not getPedOccupiedVehicle(localPlayerthen return end
        showCursor(true)
        addEventHandler("onClientRender"getRootElement(), dxDraw)
        setElementData(localPlayer"systemos:open"true)
    end
end
bindKey("O""down"openClose)

addEventHandler("onClientClick"root, function(buttonstate)
    if getElementData(localPlayer"systemos:open") == true then
        if button == "left" and state == "down" then
            local vehicle getPedOccupiedVehicle(localPlayer)
            if mousePosition(screenW 0.8042screenH 0.3046screenW 0.1219screenH 0.0148then
                triggerServerEvent("firstLights"localPlayervehiclevehicleid)
            elseif mousePosition(screenW 0.8042screenH 0.3287screenW 0.1219screenH 0.0148then
                triggerServerEvent("secondLights"localPlayervehiclevehicleid)
            elseif mousePosition(screenW 0.8042screenH 0.3528screenW 0.1219screenH 0.0148then
                triggerServerEvent("thirdLights"localPlayervehiclevehicleid)
            elseif mousePosition(screenW 0.8042screenH 0.3769screenW 0.1219screenH 0.0148then
                triggerServerEvent("toggleBelt"localPlayervehiclevehicleid)
            elseif mousePosition(screenW 0.8042screenH 0.5528screenW 0.1219screenH 0.0148then
                triggerServerEvent("checkSiren"localPlayervehiclevehicleid)
            end
        end
    else return end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-14, 19:55


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Wstaw warunek w funkcji openClose po stronie klienta ( w warunku wstaw ten kod co ju? tam jest ).

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-14, 19:57


Wydra







Wiek: 25
Na forum: 2207 dni
Posty: 10
Nick w MP: Xsardnes



Respekt: 50

W jaki sposob - co wpisa? bo nie zbyt rozumiem i po ktorej stronie - clienta czy serwera

[ Dodano: 2020-11-14, 20:08 ]
nie m?g? by? mi da? gotowego kodu bo nie wiem totalnie o co z tym chodzi i jak to zrobic

[ Dodano: 2020-11-14, 20:23 ]
nie moze mi wprost napisa? ktos - co gdzie wpisa? i jak? bo juz mi psycha siada - potrzebuje aby skrypt dzia?a? tylko dla os?b b?dacych na s?uzbie frakcji SAPD pod gamemode Play Your Stories 3.0

[ Dodano: 2020-11-14, 20:52 ]
Ja nie wiem w?asnie totalnie jak skorezystac z Element Daty - motam sie z tym od 3 godzin i nadal nic mi nie wychodzi

Komentarz PatryKK. dodany 2020-11-14, 20:46To jest dział do udzielania pomocy, nie do wyręczania i dawania gotowców. Przez takie coś niczego się nie nauczycie.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-14, 20:53


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Napisze to dzisiaj 4 raz - po co si? bra? za co? co jest kompletnie nieznane zamiast zacz?? od podstaw i nauczy? si? robi? samemu?

Postaw piwo autorowi tego posta
 

 
Tagi: skrypt :: oświetlenie :: sapd
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Skrypt na Oświetlenie SAPD Odpowiedz do tematu

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku