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

Wysłany: 2018-07-03, 22:30


HeviK*







Wiek: 29
Na forum: 3016 dni
Posty: 34

Piwa: 2

Respekt: 40,5

Witam, zn?w przychodz? z pytaniem czemu nie dzia?a mi totalkills ?
Mam w skrypcie zrobione zab?jstwo jak np. na jednym ?yciu zabije osobe to wyswietla mi sie to ale niestety nie dziala mi to, ?e zapisuje do totalkills mi tego ;/

 getElementData element"murders" 
- to funkcja od killi na jednym ?yciu

 peds getElementsByType("ped"players getElementsByType("player"addEventHandler "onPlayerWasted"root, 
    function( totalAmmokillerkillerWeaponbodypartstealth ) 
        if killer == players and killer ~= peds and source == players and source ~= peds then 
            local account getPlayerAccount killer ) 
            if killer ~= source then 
                setAccountDataaccount,"totalkillsdeaths.Kills",tonumbergetAccountDataaccount,"totalkillsdeaths.Kills" ) or ) +) 
                setElementDatakiller"Kills"tonumbergetAccountDataaccount,"totalkillsdeaths.Kills" ) ) ) 
                setElementDatakiller"Ratio"tonumber(getElementDatakiller"Kills" )/getElementDatasource"Deaths") ) ) 
            end  
        else 
            local accountSource getPlayerAccount source ) 
            setAccountDataaccountSource,"totalkillsdeaths.Deaths",tonumbergetAccountData(accountSource,"totalkillsdeaths.Deaths") or ) +) 
            setElementDatasource"Deaths"tonumbergetAccountDataaccountSource,"totalkillsdeaths.Deaths" ) ) ) 
            setElementDatasource"Ratio"tonumber(getElementDatakiller"Kills" )/getElementDatasource"Deaths") ) ) 
        end 
    end 
)       
  
addEventHandler"onPlayerLogin",root, 
    function( thePreviousAccounttheCurrentAccountautoLogin ) 
        local account getPlayerAccount source ) 
        if not getAccountDataaccount,"totalkillsdeaths.Kills" ) and not getAccountDataaccount,"totalkillsdeaths.Deaths" then 
            setAccountDataaccount,"totalkillsdeaths.Kills",) 
            setAccountDataaccount,"totalkillsdeaths.Deaths",) 
        end 
        setElementDatasource,"Deaths",tonumbergetAccountDataaccount,"totalkillsdeaths.Deaths" ) or ) ) 
        setElementDatasource,"Kills",tonumbergetAccountDataaccount,"totalkillsdeaths.Kills" ) or ) ) 
        setElementDatasource"Ratio"getElementDatasource"Kills" )/getElementDatasource"Deaths") ) 
    end 
 )


Ca?a funkcja od Killi, ded?w i ratio
daje zimne PIWKO i reputacje za pomoc ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-03, 22:51


amited







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

Piwa: 512

Respekt: 466
Respekt: 466

nwm ale przyda?oby si? DB3 i konkretna linijka od tego :)

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

 
Wysłany: 2018-07-03, 23:30


HeviK*







Wiek: 29
Na forum: 3016 dni
Posty: 34

Piwa: 2

Respekt: 40,5

Nie wywala bledow w debugscripcie o dziwo. A wiec wytlumacze ci o co chodzi:
Mam scoreboard i dodaje do niego tabele z totalkills, totaldead i Kill and dead ratio
scoreboardColumns = {
    { name "Gracze"width 200data = function (element) return getPlayerName element end },
    { name "Zab?jstwa"width 100data = function (element) return ( getElementData element"murders" ) or end },
    { name "Wszystkie zab?jstwa"width 100data = function (element) return ( getElementData element"totalkillsdeaths.Kills" ) or end },
    { name "Zgony"width 80data = function (element) return getElementData element"Deaths" ) or 0 end },
    { name "Zabite Zombie"width 80data = function (element) return ( getElementData element"zombieskilled" ) or end },
    { name "Czas ?ycia"width 80data = function (element) return formatTimeFromMinutes(getElementData element"alivetime" ) or end },
    { name "Grupa"width 150data = function (element) return ( getElementData element"gang" ) or "Brak" end },
    --{ name "KDr"width 80data = function (element) return getElementData element"Ratio" ) or 0 end },

}


murders
odpowiada za kille przy jednym ?yciu (chodzi o to, ?e je?li zabijesz 4 osoby to masz tutaj liczbe 4, ale je?li zginiesz to resetuje sie) a mi chodzi o total kills wi?c nie chce zeby sie resetowa?o i chce zeby sie to zapisywalo.

A linijki konkretnej nie wska?e ci, bo ja pisz?c skrypt niestety ?le jak?? z danych wpisalem i co? nie dzia?a mi. Ale g??wnie jest to:
 setAccountDataaccount,"totalkillsdeaths.Kills",tonumbergetAccountDataaccount,"totalkillsdeaths.Kills" ) or ) +) 
                setElementDatakiller"Kills"tonumbergetAccountDataaccount,"totalkillsdeaths.Kills" ) ) ) 


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-04, 01:28


nanKy







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

Piwa: 1773

Respekt: 239
Respekt: 239Respekt: 239

    
name "Wszystkie zab?jstwa"width 100data = function (element) return ( getElementData element"Kills" ) or end },

sprawd? to.

Postaw piwo autorowi tego posta
 

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


HeviK*







Wiek: 29
Na forum: 3016 dni
Posty: 34

Piwa: 2

Respekt: 40,5

Nie dzia?a, zabojstwa zalicza ale wszystkich zabojst juz nie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-04, 13:14


_jvneczek







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

Piwa: 3949

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

HeviK*, zr?b to na podstawie bazy danych, zr?b ?e b?dzie ci to zapisywa? w bazie danych, i z bazy danych b?dzie ci wyczytywa? kille.

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-04, 13:22


HeviK*







Wiek: 29
Na forum: 3016 dni
Posty: 34

Piwa: 2

Respekt: 40,5

My?la?em nad tym, tylko chc? jeszcze popr?bowa? tym sobosobem. Je?li kto? ma jeszcze jaki? pomys? prosze pom??cie ;(

Postaw piwo autorowi tego posta
 

 
Tagi: totalkills :: nie :: działa
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