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

Wysłany: 2016-07-04, 14:35


sabarupl







Wiek: 43
Na forum: 4825 dni
Posty: 347

Piwa: 163

Respekt: 230
Respekt: 230Respekt: 230

Mam taki skrypt. Ma on zapisywa? kas? po wyj?ciu z serwera lecz nie zapisuje. Co jest ?le?

function playerLogin (thePreviousAccounttheCurrentAccountautoLogin)
if not (isGuestAccount (getPlayerAccount(source))) then
local accountData getAccountData (theCurrentAccount"kasa")
if (accountDatathen
local playerMoney getAccountData(theCurrentAccount"kasa")
playerMoney tonumber(playerMoney)
setPlayerMoney(sourceplayerMoney)
end
end
end
addEventHandler("onPlayerLogin"getRootElement(), playerLogin)

function onQuit()
if not (isGuestAccount (getPlayerAccount (source))) then
account getPlayerAccount (source)
if (accountthen
setAccountData(account,"kasa"tostring(getPlayerMoney(source)))
end
end
end
addEventHandler("onPlayerQuit"getRootElement(), onQuit)


<meta>
    <info author="test" version="0.1" type="resource"/>
    <script src="zapisywanie_kasy.lua" type="server" />  -- zapisywanie kasy
</meta>


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-04, 14:36


_Wicek_

Majstersztyk






Wiek: 25
Na forum: 4260 dni
Posty: 747
Nick w MP: Wicek

Piwa: 1841

Respekt: 360,5
Respekt: 360,5Respekt: 360,5Respekt: 360,5Respekt: 360,5

Ostrzeżeń: 40%
sabarupl, A system kont masz ten "zwyk?y" czy MySQL itp ?

Podpis

Support-Team: 25.01.2016
Moderator: 10.07.2016




GG: 51274621
Skype : kuba_wicinski
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-04, 19:10


luki123luki123

Place Game






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

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

sabarupl, sprawdz tak:
function playerLogin ()
    local AccountPlayer getPlayerAccount source )
    if isGuestAccount(AccountPlayerthen return end
    local kasa getAccountDataAccountPlayer"kasa")
    if kasa then else return end
    setPlayerMoney(sourcekasa)
end
addEventHandler("onPlayerLogin"getRootElement(), playerLogin)


function onQuit()
    local AccountPlayer getPlayerAccount source )
    if isGuestAccount(AccountPlayerthen return end
    local kasaGracza getPlayerMoney(source)
    if kasaGracza then else return end
    setAccountDataAccountPlayer"kasa"kasaGracza)
end
addEventHandler("onPlayerQuit"getRootElement(), onQuit)


Postaw piwo autorowi tego posta
 

 
Tagi: nie :: zapisuje :: kasy
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