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

Wysłany: 2018-07-25, 22:08


Ognisty_12877







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

Piwa: 1

Respekt: 60

Witam to znowu ja z problemem zapisywania killi. Prosze o pomoc


To jest Funkcja na wyswietlenie killi, lecz gdy dam getAccountData( account, "allKills") nie dzia?a

    name "Wszystkie zab?jstwa"width 100data = function (element) return ( getElementDataelement"allKills" ) or "null" end },


A to Funkcja na sprawdzanie killi i zapisywanie niby konta mamy na serial funkcja ktora robi konta jest nizej

addEventHandler "onPlayerWasted"root,
    function( totalAmmokillerkillerWeaponbodypartstealth )
        if killer then
            local account getPlayerSerial killer )
            if killer ~= source then
                setAccountDataaccount,"allKills",tonumbergetAccountDataaccount,"allKills" ) or ) +)
                setElementDatakiller"KDr"tonumber(getElementDatakiller"T/K" )/getElementDatasource"T/D") ) )
            end 
        else
            local accountSource getPlayerSerial source )
            setAccountDataaccountSource,"Deaths",tonumbergetAccountData(accountSource,"Deaths") or ) +)
            setElementDatasource"KDr"getElementDatakiller"T/K" )/getElementDatasource"T/D") )
        end
    end
)      
 
addEventHandler"onPlayerLogin",root,
    function( thePreviousAccounttheCurrentAccountautoLogin )
        local account getPlayerSerial source )
        if not getAccountDataaccount,"allKills" ) and not getAccountDataaccount,"Deaths" then
            setAccountDataaccount,"allKills",)
            setAccountDataaccount,"Deaths",)
        end
        setElementDatasource"KDr"getElementDatasource"T/K" )/getElementDatasource"T/D") )
    end
)


function Sprawdzenie(plr,cmd)
    local account getPlayerSerial(plr)
    local data getAccountData(account"allKills") or "a jednak nie ma..."
    for iv in ipairs(getElementsByType("player")) do
        outputChatBox(data,v)
    end    
end
addCommandHandler("sprawdzenie",Sprawdzenie)



Funkcja na tworzenia konta na serial

function enterPlayer()
    local username tostring (getPlayerSerial (source))
    local account getAccount (username)
    if (account == falsethen
        account addAccount (username"o43'6Ap4=H")
        logIn (sourceaccount"o43'6Ap4=H")
        triggerClientEvent source"hideLoginWindow"getRootElement())
        triggerEvent("onPlayerDayZRegister"getRootElement(),username,"o43'6Ap4=H",source)
        return
    end
    if not logIn (sourceaccount"o43'6Ap4=H"then
        setAccountPassword (account"o43'6Ap4=H")
        logIn (sourceaccount"o43'6Ap4=H")
    end
    triggerClientEvent source"hideLoginWindow"getRootElement())
    triggerEvent("onPlayerDayZLogin"getRootElement(),username,"o43'6Ap4=H",source)
end
addEvent("onRequestEnter",true)
addEventHandler("onRequestEnter",getRootElement(),enterPlayer)



PLS HELP. Daje zmro?one piwko i respekcik

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-25, 22:18


nanKy







Wiek: 22
Na forum: 3865 dni
Posty: 498
Nick w MP: nanky

Piwa: 1773

Respekt: 239
Respekt: 239Respekt: 239

addEventHandler "onPlayerWasted"root,
    function( totalAmmokillerkillerWeaponbodypartstealth )
        if killer then
            local account getPlayerAccount(killer)
            if killer ~= source then
                setAccountDataaccount,"allKills",tonumbergetAccountDataaccount,"allKills" ) or ) +)
                setElementDatakiller"KDr"tonumber(getElementDatakiller"T/K" )/getElementDatasource"T/D") ) )
            end 
        else
            local accountSource getPlayerAccount(source)
            setAccountDataaccountSource,"Deaths",tonumbergetAccountData(accountSource,"Deaths") or ) +)
            setElementDatasource"KDr"getElementDatakiller"T/K" )/getElementDatasource"T/D") )
        end
    end
)      
 
addEventHandler"onPlayerLogin",root,
    function( thePreviousAccounttheCurrentAccountautoLogin )
        local account getPlayerAccount(source)
        if not getAccountDataaccount,"allKills" ) and not getAccountDataaccount,"Deaths" then
            setAccountDataaccount,"allKills",)
            setAccountDataaccount,"Deaths",)
        end
        setElementDatasource"KDr"getElementDatasource"T/K" )/getElementDatasource"T/D") )
    end
)


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

i...
function enterPlayer()
    local username tostring (getPlayerSerial (source))
    local account getAccount (username)
    if (account == falsethen
        account addAccount (username"o43'6Ap4=H")
        logIn (sourceaccount"o43'6Ap4=H")
        setElementData(source,'allKills',(getAccountData(account,'allKills') or 0))
        triggerClientEvent source"hideLoginWindow"getRootElement())
        triggerEvent("onPlayerDayZRegister"getRootElement(),username,"o43'6Ap4=H",source)
        return
    end
    if not logIn (sourceaccount"o43'6Ap4=H"then
        setAccountPassword (account"o43'6Ap4=H")
        logIn (sourceaccount"o43'6Ap4=H")
    end
    triggerClientEvent source"hideLoginWindow"getRootElement())
    triggerEvent("onPlayerDayZLogin"getRootElement(),username,"o43'6Ap4=H",source)
end
addEvent("onRequestEnter",true)
addEventHandler("onRequestEnter",getRootElement(),enterPlayer)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-25, 22:46


Ognisty_12877







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

Piwa: 1

Respekt: 60

Gdy Zresetowalem oba skrypty po zreconnectowaniu po zabiciu gracza i sprawdzenie komend? wyskakuje ?e a jednak nie ma... tak jak jest w tej funkij

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-25, 22:55


nanKy







Wiek: 22
Na forum: 3865 dni
Posty: 498
Nick w MP: nanky

Piwa: 1773

Respekt: 239
Respekt: 239Respekt: 239

sprawd? to...


addEventHandler "onPlayerWasted"root,
    function( totalAmmokillerkillerWeaponbodypartstealth )
        if killer then
            if killer ~= source then
            local account getPlayerAccount(killer)
                setAccountDataaccount,"allKills",tonumbergetAccountDataaccount,"allKills" ) or ) +)
                setElementDatakiller"KDr"tonumber(getElementDatakiller"T/K" )/getElementDatasource"T/D") ) )
            end 
        else
            local accountSource getPlayerAccount(source)
            setAccountDataaccountSource,"Deaths",tonumbergetAccountData(accountSource,"Deaths") or ) +)
            setElementDatasource"KDr"getElementDatakiller"T/K" )/getElementDatasource"T/D") )
        end
    end
)      
 
addEventHandler"onPlayerLogin",root,
    function( thePreviousAccounttheCurrentAccountautoLogin )
        local account getPlayerAccount(source)
        if not getAccountDataaccount,"allKills" ) and not getAccountDataaccount,"Deaths" then
            setAccountDataaccount,"allKills",)
            setAccountDataaccount,"Deaths",)
        end
        setElementDatasource"KDr"getElementDatasource"T/K" )/getElementDatasource"T/D") )
    end
)


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


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Ognisty_12877
Wysłany: 2018-07-25, 22:58


Ognisty_12877







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

Piwa: 1

Respekt: 60

Dalej wyskakuje to samo co wczesniej jakby nie bylo takiej Daty da sie jakos zeby do txt zapisywa?o sie

[ Dodano: 2018-07-26, 10:56 ]
Dobra za pomoc w tym dostajesz respekcik i piwero , lecz niestety dalej to niedzia?a zrobi?em to pro?ciej
nw co jest nie tak, a gdy sprawdzam komed? sprawdzenie po resecie pisze "a jednak nie ma..." a jak zreconnectuje pisze ze 0 czyli jak tu jest
        if not getAccountDataaccount,"zabicia" then
            setAccountDataaccount,"zabicia",)
a po zabicu gracza i tak sie nie zapisuje:

addEventHandler "onPlayerWasted"root,
    function( totalAmmokillerkillerWeaponbodypartstealth )
        if killer then
            if killer ~= source then
            local account getPlayerAccount(killer)
                setAccountDataaccount,"zabicia",tonumbergetAccountDataaccount,"zabicia" ) or ) +)
            end 
        end
    end
)      
 
addEventHandler"onPlayerLogin",root,
    function( thePreviousAccounttheCurrentAccountautoLogin )
        local account getPlayerAccount(source)
        if not getAccountDataaccount,"zabicia" then
            setAccountDataaccount,"zabicia",)
        end
    end
)


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





login

function enterPlayer()
    local username tostring (getPlayerSerial (source))
    local account getAccount (username)
    if (account == falsethen
        account addAccount (username"o43'6Ap4=H")
        logIn (sourceaccount"o43'6Ap4=H")
        setElementData(source,'zabicia',(getAccountData(account,'zabicia') or 0))
        triggerClientEvent source"hideLoginWindow"getRootElement())
        triggerEvent("onPlayerDayZRegister"getRootElement(),username,"o43'6Ap4=H",source)
        return
    end
    if not logIn (sourceaccount"o43'6Ap4=H"then
        setAccountPassword (account"o43'6Ap4=H")
        logIn (sourceaccount"o43'6Ap4=H")
    end
    triggerClientEvent source"hideLoginWindow"getRootElement())
    triggerEvent("onPlayerDayZLogin"getRootElement(),username,"o43'6Ap4=H",source)
end
addEvent("onRequestEnter",true)
addEventHandler("onRequestEnter",getRootElement(),enterPlayer)


[ Dodano: 2018-07-26, 11:10 ]
a ta komnda jako? dzia?a

local account getPlayerAccount (killer)
local data getAccountData(account,"zabicia")
function SetKills(player,cmd,playername,kills)
if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then  
    if playername and kills then
      local player2 findPlayerByName(playername)
      if player2 then
      
       if tonumber(kills) and tonumber(kills) >= 1 then
       
       setElementDataplayer2"zabicia",tonumber(kills))
       setAccountData(account,"zabicia",data+1)
       setAccountData getPlayerAccount (player2), "zabicia"tonumber(kills))
       end
      end
    end
end
end
addCommandHandler("setk",SetKills)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-28, 12:36


_jvneczek







Wiek: 22
Na forum: 4325 dni
Posty: 1513
Nick w MP: _jvneczek

Piwa: 3949

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

Nie lepiej zrobi? to na mysql? zrobi? tabele accounts i po prostu logowanie pod mysql i kolumne ,,kills" czy tam ,,allkills" i po prostu za ka?de zab?jstwo niech dodaje +1 do tabeli.

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
 

 
Tagi: wszystkie :: zabójstwa
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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