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

Wysłany: 2018-07-05, 00:03


Ognisty_12877







Wiek: 24
Na forum: 3033 dni
Posty: 52
Nick w MP: Delti

Piwa: 1

Respekt: 60

Witam tworze serwer dayz i nie mam poj?cia jak zapisywa? wszystkie kille gracza. Bo kille na jednym zyciu gracza (czyli np je?eli gracz nie zgin?? to pokazuje ile ma killi a ja chc? ?eby one si? zapisywa?y i pokazywa?y ??cznie ile ich jest) si? wy?wietlaj?.

Prosze pom??cie

To co wyswietla kille na jednym zyciu to "murders"


Stawiam piwko osobie kt?ra pomo?e mi to zrobi?

Ref

Ostatnio zmieniony przez Ognisty_12877 2018-07-06, 18:49, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-05, 07:51


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8


Więcej informacji znajdziesz w Wikipedii MTA:

setAccountData

lub

Więcej informacji znajdziesz w Wikipedii MTA:

getElementData
, ale po wyj?ciu z serwera musia?by? to zapisa? (np. za pomoc? funkcji, kt?r? poda?em jako pierwsz?)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-05, 08:04


_jvneczek







Wiek: 22
Na forum: 4466 dni
Posty: 1509
Nick w MP: _jvneczek

Piwa: 3960

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5

zr?b to pod baze sql/mysql b?dzie ci zapisywa? kille, a gdy wejdziesz to b?dzie ci pobiera?o dane z tabeli ,,murders" wtedy by szybciej by?o.

Podpis

Support Team: 04.10.2020 - 01.09.2020
Test Moderator: 03.05.2021 - 01.09.2021
Moderator: 01.09.2021 - 23.10.2021

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-05, 16:10


Ognisty_12877







Wiek: 24
Na forum: 3033 dni
Posty: 52
Nick w MP: Delti

Piwa: 1

Respekt: 60

Zrobi?em takie co? i dalej zapis nie dzia?a co tu mo?e by? ?le. Pomo?ecie ?




addEventHandler ( "onPlayerWasted", root,
    function( totalAmmo, killer, killerWeapon, bodypart, stealth )
        if killer then
            local account = getPlayerAccount ( killer )
            if killer ~= source then
                setAccountData( account,"totalkillsdeaths.Kills",tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) or 0 ) +1 )
        end 
    end
end
)
addEventHandler( "onPlayerLogin",root,
    function( thePreviousAccount, theCurrentAccount, autoLogin )
        local account = getPlayerAccount ( source )
        if not getAccountData( account,"totalkillsdeaths.Kills" ) then
            setAccountData( account,"totalkillsdeaths.Kills",0 )
        end
    end
 )


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-05, 17:25


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

sprawdzasz czy nie ma daty ale ju? nie je?eli jest:

addEventHandler( "onPlayerLogin",root,function( thePreviousAccount, theCurrentAccount, autoLogin )
local account = getPlayerAccount ( source )
local data = getAccountData( account,"totalkillsdeaths.Kills" )
if not data then
setAccountData( account,"totalkillsdeaths.Kills",0 )
else
setAccountData( account,"totalkillsdeaths.Kills",data)
end
end)

I dlaczego bawisz si? w takie idiotyczne nazwy zmiennych?

[ Dodano: 2018-07-05, 17:30 ]

addEventHandler ( "onPlayerWasted", root,function( totalAmmo, killer, killerWeapon, bodypart, stealth )
    if killer then
        local account = getPlayerAccount (killer)
        if killer ~= source then
            local data = getAccountData(account,"totalkillsdeaths.Kills")
            if data then
                setAccountData(account,"totalkillsdeaths.Kills",data+1)
            else
                setAccountData(account,"totalkillsdeaths.Kills",1)
            end
        end 
    end
end)

a no i to

szczerze nie bawi?bym bym si? w AccountDaty bo kiedy chcesz sprawdzi? inne Daty np. je?eli kilka musz? true etc to musisz je wszystkie pobra?. nie lepiej mysql? je?eli nie potrafisz to czas najwy?szy si? nauczy? :)

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 2 piw(a):
Ognisty_12877, HeviK*
Wysłany: 2018-07-05, 17:43


Ognisty_12877







Wiek: 24
Na forum: 3033 dni
Posty: 52
Nick w MP: Delti

Piwa: 1

Respekt: 60

Mam to zrobione tak i dlaej nie dzia?a a nie umiem niestety zapisac tego do mysql. Co w takiej sytuacji mam zrobic ? Chyba ?e kto? wie i napisze mi Funkcje

addEventHandler ( "onPlayerWasted", root,function( totalAmmo, killer, killerWeapon, bodypart, stealth )
    if killer then
        local account = getPlayerAccount (killer)
        if killer ~= source then
            local data = getAccountData(account,"totalkillsdeaths.Kills")
            if data then
                setAccountData(account,"totalkillsdeaths.Kills",data+1)
            else
                setAccountData(account,"totalkillsdeaths.Kills",1)
            end
        end 
    end
end)

addEventHandler( "onPlayerLogin",root,function( thePreviousAccount, theCurrentAccount, autoLogin )
    local account = getPlayerAccount ( source )
    local data = getAccountData( account,"totalkillsdeaths.Kills" )
    if not data then
        setAccountData( account,"totalkillsdeaths.Kills",0 )
        else
        setAccountData( account,"totalkillsdeaths.Kills",data)
    end
end)


[ Dodano: 2018-07-05, 17:53 ]
a zeby wyswietlic to mam to




{ name = "Wszystkie zab?jstwa", width = 100, data = function (element) return ( getAccountData ( element, "totalkillsdeaths.Kills" ) or 0 ) end },


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
HeviK*
Wysłany: 2018-07-05, 18:01


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

Zrob normalna funkcje ktora tam pobiera ta date i tam gdzie ja chcesz wyswietlic to ja wywolujesz.

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-05, 18:11


Ognisty_12877







Wiek: 24
Na forum: 3033 dni
Posty: 52
Nick w MP: Delti

Piwa: 1

Respekt: 60

a jak? dok?adnie funkcje?

[ Dodano: 2018-07-05, 18:14 ]
piwerko juz dosta?es za pomoc thx

[ Dodano: 2018-07-05, 18:18 ]
tylko dalej nie wiem o jaka funkcjie ci chodzi

mam takie cos

scoreboardColumns = {
    { name = "Gracze", width = 200, data = function (element) return getPlayerName ( element ) end },
    { name = "Zab?jstwa", width = 100, data = function (element) return ( getElementData ( element, "murders" ) or 0 ) end },
    { name = "Wszystkie zab?jstwa", width = 100, data = function (element) return ( getElementData ( element, "totalkillsdeaths.Kills" ) or 0 ) end },
    { name = "Zgony", width = 80, data = function (element) return getElementData ( element, "Deaths" ) or 0 end },
    { name = "Zabite Zombie", width = 80, data = function (element) return ( getElementData ( element, "zombieskilled" ) or 0 ) end },
    { name = "Czas ?ycia", width = 80, data = function (element) return formatTimeFromMinutes(getElementData ( element, "alivetime" ) or 1 ) end },
    --{ name = "Онлайн", width = 80, data = function (element) return getElementData ( element, "playersTable" ) or 10 end },
    --{ name = "Pieni?dze", width = 80, data = function (element) return getElementData ( element, "Pieni?dze" ) or 0 end },
    { name = "Grupa", width = 150, data = function (element) return ( getElementData ( element, "gang" ) or "Brak" ) end },
    --{ name = "KDr", width = 80, data = function (element) return getElementData ( element, "Ratio" ) or 0 end },

}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-05, 18:23


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

Zr?b now? funkcje gdzie bedziesz na chacie wyswietlal zabicia gracza. Musimy wiedziec gdzie lezy blad.

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-05, 18:36


Ognisty_12877







Wiek: 24
Na forum: 3033 dni
Posty: 52
Nick w MP: Delti

Piwa: 1

Respekt: 60

Mam takie cos ale niestety jest b?ad

function Sprawdzenie (playersource,command,reason)
if (isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(playersource)), aclGetGroup("Admin")))  then
    for i, player in ipairs(getElementsByType("player")) do
        outputChatBox("cos"(getAccountData(element, "totalkillsdeaths.Kills")), player, 255, 255, 255, true)
    end    
end
end
addCommandHandler("sprawdzenie",Sprawdzenie)


[ Dodano: 2018-07-05, 19:02 ]
Mo?e tu gdzie? jest b??d bo dalej te kille nie dzia?aj? a jak robi? t? funkcji? na chat to mam b??dy. Nie wyczymie no



local sw, sh = guiGetScreenSize()

scoreboardColumns = {
    { name = "Gracze", width = 200, data = function (element) return getPlayerName ( element ) end },
    { name = "Zab?jstwa", width = 100, data = function (element) return ( getElementData ( element, "murders" ) or 0 ) end },
    { name = "Wszystkie zab?jstwa", width = 100, data = function (element) return ( getElementData ( element, "totalkillsdeaths.Kills" ) or 0 ) end },
    { name = "Zgony", width = 80, data = function (element) return getElementData ( element, "Deaths" ) or 0 end },
    { name = "Zabite Zombie", width = 80, data = function (element) return ( getElementData ( element, "zombieskilled" ) or 0 ) end },
    { name = "Czas ?ycia", width = 80, data = function (element) return formatTimeFromMinutes(getElementData ( element, "alivetime" ) or 1 ) end },
    --{ name = "Онлайн", width = 80, data = function (element) return getElementData ( element, "playersTable" ) or 10 end },
    --{ name = "Pieni?dze", width = 80, data = function (element) return getElementData ( element, "Pieni?dze" ) or 0 end },
    { name = "Grupa", width = 150, data = function (element) return ( getElementData ( element, "gang" ) or "Brak" ) end },
    --{ name = "KDr", width = 80, data = function (element) return getElementData ( element, "Ratio" ) or 0 end },

}



addEventHandler ( "onPlayerWasted", root,function( totalAmmo, killer, killerWeapon, bodypart, stealth )
    if killer then
        local account = getPlayerAccount (killer)
        if killer ~= source then
            local data = getAccountData(account,"totalkillsdeaths.Kills")
            if data then
                setAccountData(account,"totalkillsdeaths.Kills",data+1)
            else
                setAccountData(account,"totalkillsdeaths.Kills",1)
            end
        end 
    end
end)

addEventHandler( "onPlayerLogin",root,function( thePreviousAccount, theCurrentAccount, autoLogin )
    local account = getPlayerAccount ( source )
    local data = getAccountData( account,"totalkillsdeaths.Kills" )
    if not data then
        setAccountData( account,"totalkillsdeaths.Kills",0 )
        else
        setAccountData( account,"totalkillsdeaths.Kills",data)
    end
end)

function Sprawdzenie () 
    sprawdze = getElementData("totalkillsdeaths.Kills") 
    outputChatBox("cos: "..sprawdze, 255, 200, 155) 
end 
addCommandHandler("sprawdz",Sprawdzenie)


[ Dodano: 2018-07-05, 19:07 ]
Jak co? moge wys?ac co chcesz ?eby to zrobi?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-05, 20:44


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466


function Sprawdzenie(plr,cmd)
    local account = getPlayerAccount(plr)
    local data = getAccountData(account, "totalkillsdeaths.Kills") or "a jednak nie ma..."
    for i, v in ipairs(getElementsByType("player")) do
        outputChatBox(data,v)
    end    
end
addCommandHandler("sprawdzenie",Sprawdzenie)

i napisz co wysz?o. Nwm jak ty ale ja nie widz? event?w kiedy gracz wyjdzie z serwera albo zostanie skrypt zatrzymany. Popraw to i dodaj komend? gdzie dajesz sobie na kille albo dedy no albo dalej tam zabijaj pedy czy co ty tam robisz

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-05, 21:31


Ognisty_12877







Wiek: 24
Na forum: 3033 dni
Posty: 52
Nick w MP: Delti

Piwa: 1

Respekt: 60





[ Dodano: 2018-07-05, 21:31 ]
kliknij w te ikonki masz tam b?ad

[ Dodano: 2018-07-05, 21:32 ]
i ja zabijam graczy innych

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-05, 21:37


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Kod amited, jest tylko po stronie SERVERA!!!

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Ognisty_12877
Wysłany: 2018-07-05, 21:57


Ognisty_12877







Wiek: 24
Na forum: 3033 dni
Posty: 52
Nick w MP: Delti

Piwa: 1

Respekt: 60

da?em to po stronie serwer i dalej nie dziala

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-05, 22:22


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

napisz co wysz?o a nie czy dzia?a... albo liczba albo "a jednak nie ma..."

[ Dodano: 2018-07-05, 22:28 ]
Jaki facepalm... wsz?dzie dajemy accoutDaty a w tabie masz ELEMENTDATY XDDD zmie? to

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Tagi: zapis :: wszystkich :: killi :: ref.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Zapis wszystkich killi ref. 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