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

Wysłany: 2021-01-06, 13:07


Matu123







Wiek: 23
Na forum: 2495 dni
Posty: 24
Nick w MP: Matu998

Piwa: 1

Respekt: 50

Witam czy jest kto? wstanie odpowiedzie? co mam zrobi? aby zapisy graczy trafia?y do bazy danych tzn pieni?dze si? zapisywa?y itd

Wspomn? i? baza danych pochodzi z Pysa 3.0

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-06, 14:02


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

Co masz dok?adnie na my?li by zapisywa? hajs. Jak masz czystego pysa to powinno Ci dzia?a? chyba ?e co? zmienia?e? lub czy ty chcesz zwi?kszy? limit hajsu przysobie?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-06, 14:14


_jvneczek







Wiek: 22
Na forum: 4326 dni
Posty: 1513
Nick w MP: _jvneczek

Piwa: 3949

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5

Domy?lnie w pysie, trafiaj? do bazy danych i si? zapisuj?, mo?liwe i? uszkodzi?e? core(w kt?rym znajduje si? zapis), rozwi? swoj? my?l.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-06, 23:52


Matu123







Wiek: 23
Na forum: 2495 dni
Posty: 24
Nick w MP: Matu998

Piwa: 1

Respekt: 50

W core nic nie rusza?em, a gm pochodzi z Santori V1 pobieraj?c paczke pisa?o i? baza pysa b?dzie zgodna, i jest bo mog? nada? range administracyjn? itd lecz w?a?nie ten jeden problem z zapisywaniem kasy/pkt rep/pojazdami

[ Dodano: 2021-01-07, 01:27 ]
Nie jestem pewny czy to jest to

Kod:

function getPremium(plr,premium)
if premium then
local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_users WHERE id=? AND premium=?",getElementData(plr,"player:sid"), premium)
if result and #result > 0 then
return true
else
return false
end
else
local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_users WHERE id=?", getElementData(plr,"player:sid"))
if result and #result > 0 then
return true
else
return false
end
end
end


function loadPlayerData(plr)
local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_users WHERE id=?", getElementData(plr,"player:sid"))
if result and #result > 0 then
local v=result[1]
setPlayerMoney(plr,v.money)
setElementModel(plr,v.skin)
setElementData(plr,"status","Aktywny")
setElementData(plr,"player:logged",true)
setElementData(plr,"player:mandate",v.mandate)
setElementData(plr,"player:license:pjA",v.pjA)
setElementData(plr,"player:license:pjB",v.pjB)
setElementData(plr,"player:license:pjC",v.pjC)
setElementData(plr,"player:license:pjL",v.pjL)
setElementData(plr,"player:srp",v.srp)
setElementData(plr,"player:workinjob",v.worker)
setElementData(plr,"player:registerdate",v.registered)
setElementData(plr,"player:hours",v.hours)
setElementData(plr,"player:skin",v.skin)
setElementData(plr,"sv",v.sv)
setElementData(plr,"player:bp", v.bp)
setElementData(plr,"player:opis", v.opis)
setElementData(plr,"player:exp_magazynier", v.exp_magazynier)
setElementData(plr,"player:zarobki_magazynier", v.zarobki_magazynier)
setElementData(plr,"player:exp_kurier", v.exp_kurier)
setElementData(plr,"player:zarobki_kurier", v.zarobki_kurier)
setElementData(plr,"player:exp_busy", v.exp_busy)
setElementData(plr,"player:zarobki_busy", v.zarobki_busy)
setElementData(plr,"player:glod", v.glod)
setElementData(plr,"player:exp_bagaze", v.exp_bagaze)
setElementData(plr,"player:zarobki_bagaze", v.zarobki_bagaze)
setElementData(plr,"player:exp_burgery", v.exp_burgery)
setElementData(plr,"player:zarobki_burgery", v.zarobki_burgery)
setElementData(plr,"player:ogol_zarobki", v.ogol_zarobki)
setElementData(plr,"marycha", v.marycha)
setElementData(plr,"player:marychaall", v.marychaall)
setElementData(plr,"player:zarobki_marycha", v.zarobki_marycha)
setElementData(plr,"marycha:przerobiona", v.marycha_przerobiona)
setElementData(plr, "player:pp", v.punktyp)
setElementData(plr, "phone:stan_konta", v.phone_stan_konta)

local spr = exports['pystories-db']:dbGet("SELECT * FROM pystories_users WHERE id=?", getElementData(plr,"player:sid"))
if spr[1].ostatnia_pozycja:len() > 1 then
local pozycja = split(spr[1].ostatnia_pozycja, ",")
local x2, y2, z2 = pozycja[1], pozycja[2], pozycja[3]
setElementData(plr, "ostatania:pozycja", {x2, y2, z2})
end

local queryA=string.format("SELECT * FROM pystories_users WHERE id=%d AND premiumdate>NOW() LIMIT 1", getElementData(plr,"player:sid"))
local resultA=exports["DB2"]:pobierzWyniki(queryA)
if (resultA) then
setElementData(plr,"player:premium",true)
setElementData(plr,"player:premiumdate",v.premiumdate)
else
setElementData(plr,"player:premium",false)
end

local mute = exports["pystories-db"]:dbGet("SELECT * FROM pystories_punish WHERE type=? AND active=1 AND serial=? AND time>NOW() LIMIT 1;", "mute", getPlayerSerial(plr))
if mute and #mute > 0 then
setElementData(plr,'mute:player',true)
end

local org=exports["pystories-db"]:dbGet("SELECT * FROM ms_organizacje WHERE code=? AND uid=? LIMIT 1", getElementData(plr,"player:organization"), getElementData(plr,"player:sid")) -- pobieramy tylko JEDEN rekord
local name = getPlayerName(plr):gsub("#%x%x%x%x%x%x","")
if org and #org > 0 then
setElementData(plr,"player:organization",org[1].code)
exports['pystories-db']:dbSet("UPDATE ms_organizacje SET actived=curdate() WHERE uid=?", getElementData(plr,"player:sid"))
end

return true
end
return false
end

addEvent("load:player",true)
addEventHandler("load:player", root, function(player)
if isElement(player) and player then
if getElementType(player) ~= "player" then return end
loadPlayerData(player)
outputDebugString("USERS> Za?‚adowano statystyki gracza: "..getPlayerName(player))
end
end)

function savePlayerData(plr)
local sid=getElementData(plr,"player:sid")
if not sid then return end
local money=getPlayerMoney(plr)
local mandate=getElementData(plr,"player:mandate")
local licensea=getElementData(plr,"player:license:pjA")
local licenseb=getElementData(plr,"player:license:pjB")
local licensec=getElementData(plr,"player:license:pjC")
local licensel=getElementData(plr,"player:license:pjL")
local srp=getElementData(plr,"player:srp")
local worker =getElementData(plr,"player:workinjob")
local hours= tonumber(getElementData(plr,"player:hours")) or 0
local exp_magazynier = getElementData(plr,"player:exp_magazynier")
local zarobki_magazynier = getElementData(plr,"player:zarobki_magazynier")
local exp_kurier = getElementData(plr,"player:exp_kurier")
local zarobki_kurier = getElementData(plr,"player:zarobki_kurier")
local exp_busy = getElementData(plr,"player:exp_busy")
local zarobki_busy = getElementData(plr,"player:zarobki_busy")
local glod = getElementData(plr,"player:glod")
local exp_bagaze = getElementData(plr,"player:exp_bagaze")
local zarobki_bagaze = getElementData(plr,"player:zarobki_bagaze")
local exp_burgery = getElementData(plr,"player:exp_burgery")
local zarobki_burgery = getElementData(plr,"player:zarobki_burgery")
local ogol_zarobki = getElementData(plr,"player:ogol_zarobki")
local bp = getElementData(plr, "player:bp")
local opis = getElementData(plr, "player:opis")
local sv = getElementData(plr, "sv")
local marycha = getElementData(plr,"marycha")
local marychaall = getElementData(plr,"player:marychaall")
local zarobki_marycha = getElementData(plr,"player:zarobki_marycha")
local marycha_przerobiona = getElementData(plr,"marycha:przerobiona")
local punktyp = getElementData(plr, "player:pp")
local phone_stan_konta = getElementData(plr, "phone:stan_konta") or 0
x,y,z = getElementPosition(plr)
local ostatnia_pozycja = x..", "..y..", "..z
local query=exports["pystories-db"]:dbSet("UPDATE pystories_users SET money=?, srp=?, mandate=?, pjA=?, pjB=?, pjC=?, pjL=?, worker=?, hours=?, exp_magazynier=?, zarobki_magazynier=?, exp_kurier=?, zarobki_kurier=?, exp_busy=?, zarobki_busy=?, glod=?, exp_bagaze=?, zarobki_bagaze=?, exp_burgery=?, zarobki_burgery=?, ogol_zarobki=?, bp=?, opis=?, marycha=?, marychaall=?, zarobki_marycha=?, marycha_przerobiona=?, punktyp=?, ostatnia_pozycja=?, phone_stan_konta=? WHERE id=?",
money, srp, mandate, licensea, licenseb, licensec, licensel, worker, hours, paczki_magazynier, zarobki_magazynier, exp_kurier, zarobki_kurier, exp_busy, zarobki_busy, glod, exp_bagaze, zarobki_bagaze, exp_burgery, zarobki_burgery, ogol_zarobki, bp, opis, marycha, marychaall, zarobki_marycha, marycha_przerobiona, punktyp, ostatnia_pozycja, phone_stan_konta, sid)
end

addEvent("save:player",true)
addEventHandler("save:player", root, function(player)
if isElement(player) and player then
if getElementType(player) ~= "player" then return end
savePlayerData(player)
outputDebugString("USERS> Zapisano statystyki gracza: "..getPlayerName(player))
end
end)
addEventHandler("onPlayerQuit", root, function() savePlayerData(source) end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-07, 11:46


_jvneczek







Wiek: 22
Na forum: 4326 dni
Posty: 1513
Nick w MP: _jvneczek

Piwa: 3949

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5

Tak to jest to, je?li ten kod ci nie zapisuje to mo?liwe i? przy exporcie pope?ni?e? liter?wke czy cokolwiek.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-07, 13:17


MarmoladaJD







Wiek: 28
Na forum: 1990 dni
Posty: 17
Nick w MP: MasnyTimmy



Respekt: 50

Baza danych pystories nie ma takich kolumn jak np. exp_magazynier, zarobki_magazynier itd, dodaj do do pystories_users i sprawd? wtedy.

Postaw piwo autorowi tego posta
 

 
Tagi: zapis
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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