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

Wysłany: 2016-08-17, 14:06


AlaneqYT

Uczeń LUA






Wiek: 26
Na forum: 4025 dni
Posty: 37

Piwa: 20

Respekt: 25,3

Ostrzeżeń: 20%
Witam, posiadam system premium i gdy si? loguje nie wczytuje mi premium.

kod:


addEvent("core:spawnPlayer", true)
addEventHandler("core:spawnPlayer", root, function()
    local pos=getElementData(source,"player:spawn")
    if not pos then return end
    fadeCamera(source, true)
    spawnPlayer(source, pos[1], pos[2], pos[3])
    setCameraTarget(source,source)
    toggleControl(source,"fire", false)
    toggleControl(source,"aim_weapon", false)
    local load=loadPlayerData(source)
    if load then     triggerClientEvent(source,"addNotification",root,"* Wczytano Twoje dane","info") end
    setElementData( source, 'HS_accountName', getPlayerName(source));
    setElementData(source, "player:online", 0)
    if getElementData(source,"player:premium") then 
        local queryA=string.format("SELECT * FROM ogrpg_users WHERE id=%d AND premiumdate>NOW() LIMIT 1", getElementData(source,"player:uid"))
        local resultA=exports["ogrpg-db"]:pobierzWyniki(queryA)
        if (resultA) then
            outputChatBox("* Konto premium wa?ne do " ..resultA["premiumdate"], source)
        end
    end
    triggerClientEvent(source,"core:blipyaut",root,source)
end)


saveplayers:

--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <split.programista@gmail.com>. All rights reserved.
]]

function loadPlayerData(plr)
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?", getElementData(plr,"player:uid"))
    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:reputation",v.reputation)
        setElementData(plr,"player:workinjob",v.worker)
        setElementData(plr,"player:registerdate",v.registered)
        setElementData(plr,"player:hours",v.hours)
        local queryA=string.format("SELECT * FROM ogrpg_users WHERE id=%d AND premiumdate>NOW() LIMIT 1", getElementData(plr,"player:uid"))
        local resultA=exports["ogrpg-db"]:pobierzWyniki(queryA)
        if (resultA) then
            setElementData(plr,"player:premium",true)
            setElementData(plr,"player:premiumdate",v.premiumdate)
            setPlayerName(plr,"#dbb234"..getPlayerName(plr))
        else
            setElementData(plr,"player:premium",false)
        end
        setElementData(plr,"player:skin",v.skin)
        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("Zaladowano statystyki gracza :"..getPlayerName(player))
end
end)
function savePlayerData(plr)
    local uid=getElementData(plr,"player:uid")
    if not uid 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 reputation=getElementData(plr,"player:reputation")
    local worker =getElementData(plr,"player:workinjob")
    local hours= tonumber(getElementData(plr,"player:hours")) or 0
    local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_users SET money=?, reputation=?, mandate=?, pjA=?, pjB=?, pjC=?, pjL=?, worker=?, hours=? WHERE id=?",
    money, reputation, mandate, licensea, licenseb, licensec, licensel,worker,hours, uid)
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("Zapisano statystyki gracza :"..getPlayerName(player))
end
end)
addEventHandler("onPlayerQuit", root, function() savePlayerData(source) end)


DB3:

ogrpg-db/s_db.lua:96: bad argument #1 'mysql_query' ( mysqlHandler expected, got nil)

i

ogrpg-core/saveplayers.lua:26 call: failed to call 'ogrpg-db:pobierzWyniki' [string "?"]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-17, 15:52


Demic

Lua&Mapping






Wiek: 29
Na forum: 4388 dni
Posty: 63
Nick w MP: Demic

Piwa: 620

Respekt: 70

db masz?

Podpis
<[email protected]>
warsaw-life.pl
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-17, 16:29


AlaneqYT

Uczeń LUA






Wiek: 26
Na forum: 4025 dni
Posty: 37

Piwa: 20

Respekt: 25,3

Ostrzeżeń: 20%
"Demic" napisał/a:

db masz?


Mam, przecie? w db3 si? wyswietlilo nawet.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-17, 18:27


eject

kurdebele






Wiek: 30
Na forum: 3800 dni
Posty: 182
Nick w MP: EjecT

Piwa: 2456

Respekt: 85,8

Ostrzeżeń: 60%
local resultA=exports["ogrpg-db"]:pobierzWyniki(queryA)

zamien na
local resultA=exports["ogrpg-db"]:dbGet(queryA)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-17, 22:01


AlaneqYT

Uczeń LUA






Wiek: 26
Na forum: 4025 dni
Posty: 37

Piwa: 20

Respekt: 25,3

Ostrzeżeń: 20%
Dzia?a dzi?kuje. Piwko.

Postaw piwo autorowi tego posta
 

 
Tagi: premium
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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