DjMPL Posted July 10, 2013 Share Posted July 10, 2013 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
dzek (varez) Posted July 10, 2013 Share Posted July 10, 2013 bo masz te linie zakomentowane? -- oznacza, że linia nie będzie wykonana Link to comment
DjMPL Posted July 10, 2013 Author Share Posted July 10, 2013 Są to moje początki z lua, dzięki za pomoc. Link to comment
dzek (varez) Posted July 10, 2013 Share Posted July 10, 2013 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 Link to comment
DjMPL Posted July 11, 2013 Author Share Posted July 11, 2013 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
Bober Posted July 11, 2013 Share Posted July 11, 2013 setPlayerMoney(source, playermoney ) Link to comment
DjMPL Posted July 12, 2013 Author Share Posted July 12, 2013 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 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now