Jump to content

Recommended Posts

Posted

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 ) 
  

Posted

bo masz te linie zakomentowane?

-- oznacza, że linia nie będzie wykonana

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

Zapoznaj się z tym tematem: viewtopic.php?f=91&t=31891

Masz tam np. IDE czyli program do pisania kodu, który koloruje Ci kod (tak jak w Twoim pierwszem poście poprawiłem - wstawiaj tagi [lua][/lua], nie


), podpowiada, pokazuje błędy itd - dużo lepiej się pisze

Powodzenia w nauce :)

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

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 ) 
  

Posted

A dokładniej w jakim miejscu bo nie wiem nie ogarniam jeszcze tego do końca a i mógłbyś opdać mi link bezpośredni do tego IDE

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...