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

Wysłany: 2014-09-24, 22:53


Ponki2x2







Wiek: 36
Na forum: 4639 dni
Posty: 19



Respekt: 50

Witam mam skrypt na savescore ale w tabeli scoreboard nie wyswietla warto?ci



exports.scoreboard:scoreboardAddColumn"Score" )
 
function xcore ()
    zcore getElementData  source"Score" ) or 0
    setElementData  source"Score"zcore )
end
addEvent ("onPlayerWasted",true)
addEventHandler ("onPlayerWasted",getRootElement (),xcore)
 
addEventHandler  'onPlayerQuit'root,
    function ( )
        local  account getPlayerAccount  source )
        local  getScore getElementData  source'Score' ) or 0
        if ( account ) and not isGuestAccount  account ) ) then
            setAccountData  account'scoreSave'getScore )
        end
    end
)
 
addEventHandler  'onPlayerLogin'root,
    function ( _account )
        if ( account then
            local  scoreLoad getAccountData  account'scoreSave' )
            if ( scoreLoad then
                setElementData  source'Score'scoreLoad )
            end
        end
    end
)



Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-25, 15:48


Tostuch







Wiek: 27
Na forum: 4931 dni
Posty: 483
Nick w MP: Tost

Piwa: 137

Respekt: 110
Respekt: 110

Jakie? b??dy w db3?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-25, 21:57


Ponki2x2







Wiek: 36
Na forum: 4639 dni
Posty: 19



Respekt: 50

Mam inny teraz problem mam save score wyci?ty z marmat'a ale po restarcie skryptu zeruje mi scora help.

Savescore.lua

function onPlayerLogin ()
        local playeraccount getPlayerAccount source )
        if ( playeraccount then
                if not isGuestAccount playeraccount then
                        local playerpkt getAccountData playeraccount"score" )
                        if ( playerpkt then
                                setElementData(source"Score"tonumber(playerpkt))
                        end
                end
        end
end

function onPlayerQuit ()
        local playeraccount getPlayerAccount source )
        if ( playeraccount then
                if not isGuestAccount playeraccount then
                        local playerpkt getElementData source"Score" )
                        if ( playerpkt then
                                setAccountData playeraccount"score"playerpkt )
                        end
                end
        end
end

addEventHandler "onPlayerLogin"getRootElement (), onPlayerLogin )
addEventHandler "onPlayerQuit"getRootElement (), onPlayerQuit )
addEventHandler ("onResourceRestart"getRootElement (), onPlayerQuit )
addEventHandler ("onResourceStop"getRootElement (), onPlayerQuit )
addEventHandler ("onResourceStart"getRootElement (), onPlayerQuit )




scores.lua


addEventHandler('onResourceStart',getResourceRootElement(),
function()
    call(getResourceFromName("scoreboard"), "addScoreboardColumn""Score")
    for theKey,thePlayer in ipairs(getElementsByType "player" )) do
        setElementData(thePlayer,"Score",0)
    setElementData(thePlayer,"Kasa",0)
    end
end)

addEventHandler('onPlayerJoin',getRootElement(),
function()

    setElementData(source,"Score",0)
    setElementData(source,"Kasa",0)
end)

function addScore(points)
    setElementData(source"score"getElementData(source"score") + points)
    setElementData(source"money"getPlayerMoney(getLocalPlayer()))
end

addEvent("addScore"true)
addEventHandler("addScore"getRootElement(), addScore)
---------dawanie score

addCommandHandler "zmienscore",
function ( playercmdnickkwota )


        if nick and kwota then
            local aplayer getPlayerFromName nick )
            if aplayer then
                kwota tonumber(kwota)
           
                    setElementData(aplayer,"Score",kwota)
                    --givePlayerMoney aplayerkwota )
        outputDebugString "Score dodane" )

else
      outputChatBox"Nie jestes Adminem"getRootElement())   
    outputDebugString "Nieudana proba dodania score." )

end 
end
end )





Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-25, 22:01


Artysta

Lua, Lua, Czekolada






Wiek: 28
Na forum: 4466 dni
Posty: 240
Nick w MP: Artysta/Koojot

Piwa: 1427

Respekt: 205,8
Respekt: 205,8Respekt: 205,8

Tu masz kod odpowiadaj?cy za zerowanie Score po uruchomieniu skryptu, wi?c usu? to :)

addEventHandler('onResourceStart',getResourceRootElement(),
function()
    call(getResourceFromName("scoreboard"), "addScoreboardColumn""Score")
    for theKey,thePlayer in ipairs(getElementsByType "player" )) do
        setElementData(thePlayer,"Score",0)
    setElementData(thePlayer,"Kasa",0)
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-25, 23:23


Ponki2x2







Wiek: 36
Na forum: 4639 dni
Posty: 19



Respekt: 50

Gdy usuno?em

addEventHandler('onResourceStart',getResourceRootElement(),
function()
    call(getResourceFromName("scoreboard"), "addScoreboardColumn""Score")
    for theKey,thePlayer in ipairs(getElementsByType "player" )) do
        setElementData(thePlayer,"Score",0)
    setElementData(thePlayer,"Kasa",0)
    end
end)
i doda?em linijk?
    call(getResourceFromName("scoreboard"), "addScoreboardColumn""Score")
W tabeli scoreboard nie pokazuje ?adniej warto?ci a powinno na start by? 0 a potem jak kto? przewiezie towar rosn?? jednak warto?? jest pusta Pomocy.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-26, 00:11


Artysta

Lua, Lua, Czekolada






Wiek: 28
Na forum: 4466 dni
Posty: 240
Nick w MP: Artysta/Koojot

Piwa: 1427

Respekt: 205,8
Respekt: 205,8Respekt: 205,8

No to zwyczajnie tak spr?buj.


addEventHandler('onResourceStart',getResourceRootElement(),
function()
    call(getResourceFromName("scoreboard"), "addScoreboardColumn""Score")
    for theKey,thePlayer in ipairs(getElementsByType "player" )) do
    end
end)


Podpis
Something is coming..
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-26, 13:48


Ponki2x2







Wiek: 36
Na forum: 4639 dni
Posty: 19



Respekt: 50

"Artysta" napisał/a:

No to zwyczajnie tak spr?buj.


addEventHandler('onResourceStart',getResourceRootElement(),
function()
    call(getResourceFromName("scoreboard"), "addScoreboardColumn""Score")
    for theKey,thePlayer in ipairs(getElementsByType "player" )) do
    end
end)


Sorka nie pomog?o nadal tabela Score pusta.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-26, 16:17


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Ponki2x2, masz na score git :D

addEventHandler('onResourceStart',getResourceRootElement(), 
function() 
call(getResourceFromName("scoreboard"), "addScoreboardColumn""Score"end
) 


function updateScore()
    for kv in ipairs(getElementsByType('player')) do
        local Scoregracya =getElementData(v"Score") 
        setElementData(v,"scoree",Scoregracya ) 
    end
end
setTimer(updateScore1000)

addEventHandler("onPlayerLogin"root, 
function() 
     accountScore getAccountData(getPlayerAccount(source), "Score")
     if (accountScorethen
          setElementData(source"Score"tonumber(accountScore)) 
     else
          setElementData(source"Score"0) 
     end
end
)

addEventHandler("onPlayerQuit"root,
function ()
     local scoreData getElementData(source"Score")
     setAccountData(getPlayerAccount(source), "Score"scoreData)
end
)

--//Wykonanie by Place Game 2014
)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-26, 17:54


Ponki2x2







Wiek: 36
Na forum: 4639 dni
Posty: 19



Respekt: 50

Dzi?ki Za zapis piwko leci.

Postaw piwo autorowi tego posta
 

 
Tagi: savescore
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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