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

Wysłany: 2019-09-13, 16:43


Szyszka947

ASP NET Core / Lua






Wiek: 19
Na forum: 2579 dni
Posty: 288

Piwa: 16

Respekt: 90

Hejo, mam skrypt taki tam o taki o, ale chc?, aby robil on cos takiego: Po zrespieniu sie gracza sprawdza ile wynosi jego data "Level", jesli ma tyle i tyle to daje mu t? i tak? bro?, a wiadomosc z pogratulowaniem za dany prog (1000) itp. ma sie pokazywac tylko raz, wtedy, kiedy gracz przekroczy ten prog, lub jego data bedzie wynosila tyle co sam prog. Kod:

addEventHandler("onPlayerLogin"getRootElement(),
function(_konto_obecne)
    setTimer(przydzielanielvla60*50*200konto_obecnesource)
    setTimer(przydzielanielvlaH60*50*200konto_obecnesource)
    local aktualny_lvl = (getAccountData(konto_obecne"Level") or 0)
    setElementData(source"Level"aktualny_lvl)
    if (aktualny_lvl >= 500000then
        giveWeapon(source37550)
        setElementData(source"Level"aktualny_lvl 300)
        outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
        return
    end
    if (aktualny_lvl >= 100000then
        giveWeapon(source165)
        setElementData(source"Level"aktualny_lvl 300)
        outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
        return
    end
    if (aktualny_lvl >= 60000then
        giveWeapon(source28150)
        giveWeapon(source2477)
        giveWeapon(source46)
        setElementData(source"Level"aktualny_lvl 300)
        outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
        return
    end
    if (aktualny_lvl >= 40000then
        giveWeapon(source5)
        setElementData(source"Level"aktualny_lvl 300)
        outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
        return
    end
    if (aktualny_lvl >= 10000then
        giveWeapon(source34200)
        setElementData(source"Level"aktualny_lvl 300)
        outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
        return
    end
    if (aktualny_lvl >= 4000then
        giveWeapon(source2660)
        setElementData(source"Level"aktualny_lvl 300)
        outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
        return
    end
    if (aktualny_lvl >= 1000then
        giveWeapon(source25100)
        setElementData(source"Level"aktualny_lvl 300)
        outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
return        
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-09-13, 22:22


Pawel5321

Szkrypter






Wiek: 36
Na forum: 3809 dni
Posty: 237
Nick w MP: Pawell

Piwa: 2315

Respekt: 240
Respekt: 240Respekt: 240

addEventHandler("onPlayerLogin"getRootElement(),
function(_konto_obecne)
    setTimer(przydzielanielvla60*50*200konto_obecnesource)
    setTimer(przydzielanielvlaH60*50*200konto_obecnesource)
    local aktualny_lvl = (getAccountData(konto_obecne"Level") or 0)
    setElementData(source"Level"aktualny_lvl)
end)
addEventHandler("onPlayerSpawn"root, function()

local aktualny_lvl=getElementData(source"Level")
if (aktualny_lvl >= 500000then
setElementData(source"Level"aktualny_lvl 300)
outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
giveWeapon(source37550)
end
if (aktualny_lvl >= 100000then
giveWeapon(source165)
setElementData(source"Level"aktualny_lvl 300)
outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
end
if (aktualny_lvl >= 60000then
giveWeapon(source28150)
giveWeapon(source2477)
giveWeapon(source46)
setElementData(source"Level"aktualny_lvl 300)
outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
end
if (aktualny_lvl >= 40000then
giveWeapon(source5)
setElementData(source"Level"aktualny_lvl 300)
outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
end
if (aktualny_lvl >= 10000then
giveWeapon(source34200)
setElementData(source"Level"aktualny_lvl 300)
outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
end
if (aktualny_lvl >= 4000then
giveWeapon(source2660)
setElementData(source"Level"aktualny_lvl 300)
outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
end
if (aktualny_lvl >= 1000then
giveWeapon(source25100)
setElementData(source"Level"aktualny_lvl 300)
outputChatBox("#00FF00[#00FFFFRESPEKT#00FF00]#FFD700GRATULACJE, #FFA500za aktywne granie otrzyma?e? now? #FFD700BRO? #FFA500oraz #FFD700300 RESPEKTU!"source255255255true)
end
end)
function outputChange(theKeyoldValuenewValue)
    if (theKey=="Level"then
if(oldValue<=przekroczonyprog and przekroczonyprog<newValue and newValue<nastepnyprog)
outputChatBox("przekroczyles prog",source)
end
    end
end
addEventHandler("onElementDataChange"rootoutputChange)


nietestowane, musisz podstawic wartosci w ostatniej funkcji

Ostatnio zmieniony przez Pawel5321 2019-09-14, 12:45, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-09-14, 10:24


Szyszka947

ASP NET Core / Lua






Wiek: 19
Na forum: 2579 dni
Posty: 288

Piwa: 16

Respekt: 90

Nie dziala to jeszcze jak chcialem, troche przerobilem, ale nadal nie potrafie sprawic, aby wiadomosc naa czacie pookazywala si? tylko raz, podczas przekroczenia progu, nie zawsze po zalogowaniu/spawnie! Tak samo z tym +300 respektu. A i ten, jakie wartosci mam dopisac? Nie kumam tej ostatniej funkcji ;v Obecny kod wyglada u mnie tak:
addEventHandler("onPlayerLogin"getRootElement(),
function(_konto_obecne)
    setTimer(przydzielanielvla60*50*200konto_obecnesource)
    setTimer(przydzielanielvlaH60*50*200konto_obecnesource)
    local aktualny_lvl = (getAccountData(konto_obecne"Level") or 0)
    setElementData(source"Level"aktualny_lvl)
end)
addEventHandler("onPlayerSpawn"root, function()

local aktualny_lvl=getElementData(source"Level")
if (aktualny_lvl >= 500000then
giveWeapon(source37550)
end
if (aktualny_lvl >= 100000then
giveWeapon(source165)
end
if (aktualny_lvl >= 60000then
giveWeapon(source28150)
giveWeapon(source2477)
giveWeapon(source46)
end
if (aktualny_lvl >= 40000then
giveWeapon(source5)
end
if (aktualny_lvl >= 10000then
giveWeapon(source34200)
end
if (aktualny_lvl >= 4000then
giveWeapon(source2660)
end
if (aktualny_lvl >= 1000then
giveWeapon(source25100)
end
end)
function outputChange(theKeyoldValuenewValue)
    if (theKey=="Level"then
if(oldValue<=przekroczonyprog and przekroczonyprog<newValue and newValue<nastepnyprogthen
end
    end
end
addEventHandler("onElementDataChange"rootoutputChange)

addEventHandler("onPlayerLogin"root, function()

local aktualny_lvl=getElementData(source"Level")
if (aktualny_lvl >= 500000then
giveWeapon(source37550)
end
if (aktualny_lvl >= 100000then
giveWeapon(source165)
end
if (aktualny_lvl >= 60000then
giveWeapon(source28150)
giveWeapon(source2477)
giveWeapon(source46)
end
if (aktualny_lvl >= 40000then
giveWeapon(source5)
end
if (aktualny_lvl >= 10000then
giveWeapon(source34200)
end
if (aktualny_lvl >= 4000then
giveWeapon(source2660)
end
if (aktualny_lvl >= 1000then
giveWeapon(source25100)
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-09-14, 10:38


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Bro? nadawaj dopiero przy onPlayerSpawn, przecie? to ju? masz zrobione. Usu? ten ostatni event.
?eby wiadomo?? pokaza?a si? tylko raz musisz w accountDacie zapisa? jak?? warto?? na true i sprawdzasz po przekroczeniu progu czy gracz ma tak? accountDat?.


addEventHandler("onElementDataChange"getRootElement(), function outputChange(theKeyoldValuenewValue)
    if (theKey=="Level"then
        if (oldValue<=przekroczonyprog and przekroczonyprog<newValue and newValue<nastepnyprog and (not getAccountData(source"zdobyto:prog"))
            outputChatBox("przekroczyles prog",source)
            setAccountData(source"zdobyto:prog"true)
        end
    end
end)


przekroczonyprog zamieniasz na odpowiedni? liczb?

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Szyszka947
Wysłany: 2019-09-14, 11:13


Pawel5321

Szkrypter






Wiek: 36
Na forum: 3809 dni
Posty: 237
Nick w MP: Pawell

Piwa: 2315

Respekt: 240
Respekt: 240Respekt: 240


local progi={1000,4000,10000,40000,60000,100000,500000}
function outputChange(theKeyoldValuenewValue)
    if (theKey=="Level"then
    for k,v in ipairs(progi) do
if(oldValue<and v<=newValuethen

outputChatBox("Przekroczyles prog - "..v)
end
    end
end
end
addEventHandler("onElementDataChange"rootoutputChange)

kod na wy?wietlanie wiadomo?ci o przekroczeniu progu

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-09-14, 12:05


Szyszka947

ASP NET Core / Lua






Wiek: 19
Na forum: 2579 dni
Posty: 288

Piwa: 16

Respekt: 90

Okej, dzia?a pi?knie po ma?ej przer?bce, tylko mam jedno pytanie. Dlaczego po przekroczeniu progu 4000 respa, skrypt dodaje ammo do shotgana za 1k respa, zamiast po prostu zamienic go z obrzynem? Jakas rada?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-09-14, 12:37


Pawel5321

Szkrypter






Wiek: 36
Na forum: 3809 dni
Posty: 237
Nick w MP: Pawell

Piwa: 2315

Respekt: 240
Respekt: 240Respekt: 240

Skrypt jest czytany od g?ry do do?u, zamie? miejscami to

if (aktualny_lvl >= 4000then
giveWeapon(source2660)
end

i to

if (aktualny_lvl >= 1000then
giveWeapon(source25100)
end


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Szyszka947
Wysłany: 2019-09-14, 13:34


Szyszka947

ASP NET Core / Lua






Wiek: 19
Na forum: 2579 dni
Posty: 288

Piwa: 16

Respekt: 90

dzieki, jzu daje respekt i piwko

Postaw piwo autorowi tego posta
 

 
Tagi: bronie :: wartosci
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » bronie za wartosci Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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