Jump to content

Recommended Posts

Witam mam skrypt na zapis kasy i score lecz jest jeden problem w tabelce nie wyświetla kasy a ni jej nie zapisuje po wyjściu z serwera o to kod:

  
function onPlayerLogin () 
        local playeraccount = getPlayerAccount ( source ) 
        if ( playeraccount ) then 
                if not isGuestAccount ( playeraccount ) then 
                        local playerpkt = getAccountData ( playeraccount, "points" ) 
                        --local playermoney = getAccountData ( playeraccount, "s.HandMoney" ) 
                        if ( playerpkt ) then 
                                setElementData(source, "Pkt", tonumber(playerpkt)) 
                                --setElementData(source, "Kasa", tonumber(playermoney)) 
                --setPlayerMoney( getRootElement(), playermoney ) 
  
                        end 
                end 
        end 
end 
  
function onPlayerQuit () 
        local playeraccount = getPlayerAccount ( source ) 
        if ( playeraccount ) then 
                if not isGuestAccount ( playeraccount ) then 
                        local playerpkt = getElementData ( source, "Pkt" ) 
                        --local playermoney = getElementData ( source, "Kasa" ) 
                        if ( playerpkt ) then 
                                setAccountData ( playeraccount, "points", playerpkt ) 
                                --setAccountData ( playeraccount, "s.HandMoney", playermoney ) 
                        end 
                end 
        end 
end 
  
addEventHandler ( "onPlayerLogin", getRootElement (), onPlayerLogin ) 
addEventHandler ( "onPlayerQuit", getRootElement (), onPlayerQuit ) 
  

Link to comment

Usunołem to i kod wygląda teraz tak ale nadal nie działa co tutaj powinienem dodać? Aby działał prawidłowo oraz zapisywał kase i score a by po restarcie serwera nadal gracz to miał?

  
function onPlayerLogin () 
        local playeraccount = getPlayerAccount ( source ) 
        if ( playeraccount ) then 
                if not isGuestAccount ( playeraccount ) then 
                        local playerpkt = getAccountData ( playeraccount, "points" ) 
                        local playermoney = getAccountData ( playeraccount, "s.handmoney" ) 
                        if ( playerpkt ) or (playermoney) then 
                                setElementData(source, "Pkt", tonumber(playerpkt)) 
                                 setElementData(source, "Kasa", tonumber(playermoney)) 
                  setPlayerMoney( getRootElement(), playermoney ) 
  
                        end 
                end 
        end 
end 
  
function onPlayerQuit () 
        local playeraccount = getPlayerAccount ( source ) 
        if ( playeraccount ) then 
                if not isGuestAccount ( playeraccount ) then 
                        local playerpkt = getElementData ( source, "Pkt" ) 
                          local playermoney = getElementData ( source, "Kasa" ) 
                        if ( playerpkt ) or (playermoney) then 
                                setAccountData ( playeraccount, "points", playerpkt ) 
                                  setAccountData ( playeraccount, "s.handmoney", playermoney ) 
                        end 
                end 
        end 
end 
  
addEventHandler ( "onPlayerLogin", getRootElement (), onPlayerLogin ) 
addEventHandler ( "onPlayerQuit", getRootElement (), onPlayerQuit ) 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...