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

Wysłany: 2020-04-19, 19:37


BureQ







Wiek: 20
Na forum: 2933 dni
Posty: 18
Nick w MP: Alonek

Piwa: 557

Respekt: 45,3

Cze??, mam ma?y problem :/ komenda daj?ca premium wpisuje je w sql i nadaje premium lecz gracz po relogu tego premium nie dostaje i nie wczytuje core, kod od saveplayers.lua

function getPremium(plr,premium)
if premium then
local result=exports["rpg_mysql"]: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

Probowa?em zrobi? z DB2 z DB z pystories-db z rpg_mysql i nic :/ Nieczyta dalej :/ a wszystko jest ustawione Premiumdate jest na jakies 4 lata jest Premium na 1. Pomo?e kto? szybko ^^? Za najlepsz? porade postawie :piwo: hyh. :mrgreen: Odst?py s? zrobione dobrze tylko tutaj ?le wygl?daj? xD

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-20, 00:40


Maniekxx

Amator






Wiek: 24
Na forum: 2894 dni
Posty: 232
Nick w MP: Maniekxx

Piwa: 225

Respekt: 110
Respekt: 110

Ostrzeżeń: 20%
Zmie? "premium=?" na "premium=NOW()", i usu? z zapytania zmienn? 'premium' czyli


local result=exports["rpg_mysql"]:dbGet("SELECT * FROM pystories_users WHERE id=? AND premium=NOW()",getElementData(plr,"player:sid"))


Albo u?yj tego kodu:


    local query=string.format("SELECT * FROM pystories_users WHERE id=%d AND premium>NOW() LIMIT 1"getElementData(plr,"player:sid"))
        local result=exports["rpg_mysql-db"]:pobierzWyniki(query)
        if (resultthen
            setElementData(plr,"player:premium",true) -- Zmien na elementData kt?rej Ty u?ywasz.
        else
            setElementData(plr,"player:premium",false) -- Zmien na elementData kt?rej Ty u?ywasz.
        end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-20, 10:13


Mezo.

Mod-Team






Wiek: 24
Na forum: 3211 dni
Posty: 548
Nick w MP: Mezo

Piwa: 6070

Respekt: 517
Respekt: 517

Spr?buj tak

function getPremium(plr,premium)
    if premium then
        local result=exports["rpg_mysql"]: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


Potem jak masz w pysie funkcje bodaj?e loadPlayerData to dopisz tam co? takiego

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 (resultAthen
            setElementData(plr,"player:premium",true)
            setElementData(plr,"player:premiumdate",v.premiumdate)
            setPlayerName(plr,"#C0FF00"..getPlayerName(plr))
            setElementData(plr,"premium:level",1)
        else
            setElementData(plr,"player:premium",false)
        end


Postaw piwo autorowi tego posta
 

 
Tagi: niedziałający :: core
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Niedziałający core Odpowiedz do tematu

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