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

Wysłany: 2019-08-28, 01:35


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Witam posiadam paczk? Your Pseudol v1-2 W skrypcie tiyl-duty s? komendy na premium oraz premium+ uda?o mi si? zrobi? tak ?e po wpisaniu kom /dajpremium oraz /dajpremiumplus nadaje range ale po wyj?ciu z serwera rangi sie nie zapisuj?


 function setPremiumDay(plr,days)
    if getPremiumDate(plrthen
    local queryA=exports['tiyl-db']:dbSet(string.format("UPDATE tiyl_gracze SET vipdate = DATE(vipdate) + INTERVAL %d DAY WHERE id=%d",days,getElementData(plr,"player:uid")))
    return end
    local queryA=exports['tiyl-db']:dbSet(string.format("UPDATE tiyl_gracze SET vipdate = DATE(current_timestamp()) + INTERVAL %d DAY WHERE id=%d",days,getElementData(plr,"player:uid")))                             api="ec8b994a9b1f6c01f14d1ee43"
end

addCommandHandler("dajpremium",function(plr,cmd,cel,dni) 
if getAdmin(plr,5) or getAdmin(plr,3then
if not cel then outputChatBox("/dajpremium [gracz] [dni]",plr) return end
if not dni then outputChatBox("/dajpremium [gracz] [dni]",plr) return end
if not tonumber(dnithen outputChatBox("/dajpremium [gracz] [dni]",plr) return end
local target=exports["tiyl-core"]:findPlayer(plr,cel)
if not target then
outputChatBox("* Nie znaleziono podanego gracza."plr25500)
return
end
setPremiumDay(target,dni)
outputChatBox("Nadano konto PREMIUM na "..dni.." dni!"plr25512864)
outputChatBox("Otrzymales konto PREMIUM na "..dni.." dni!"target25512864)
setElementData(target,"player:vip",true)
triggerEvent("save:player",root,target)
triggerEvent("load:player",root,target)
end
end)

addCommandHandler("dajpremiumplus",function(plr,cmd,cel,dni) 
if getAdmin(plr,5then 
if not cel then outputChatBox("/dajpremiumplus [gracz] [dni]",plr) return end 
if not dni then outputChatBox("/dajpremiumplus [gracz] [dni]",plr) return end 
if not tonumber(dnithen outputChatBox("/dajpremium [gracz] [dni]",plr) return end 
local target=exports["tiyl-core"]:findPlayer(plr,cel) 
if not target then 
outputChatBox("* Nie znaleziono podanego gracza."plr25500) 
return 
end 
setsPremiumDay(target,dnioutputChatBox("Nadano konto PREMIUM+ na "..dni.." dni graczowi " .. getPlayerName(target) .. "!"plr25512864outputChatBox("Otrzymales konto PREMIUM+ na "..dni.." dni!"target25512864setElementData(target,"player:svip",truetriggerEvent("save:player",root,targettriggerEvent("load:player",root,targetend 
end) 

function getPremiumDate(plrlocal queryA=exports['tiyl-db']:dbGet("SELECT * FROM tiyl_gracze WHERE id=? AND vipdate>NOW() LIMIT 1"getElementData(plr,"player:uid")) 
if (queryA and #queryA > 0) then 
return queryA[1].vipdate 
end 
return false    
end 

function setsPremiumDay(plr,days) 
if getsPremiumDate(plrthen 
local queryA=exports['tiyl-db']:dbSet(string.format("UPDATE tiyl_gracze SET svipdate = DATE(svipdate) + INTERVAL %d DAY WHERE id=%d",days,getElementData(plr,"player:uid"))) 
return end 
local queryA=exports['tiyl-db']:dbSet(string.format("UPDATE tiyl_gracze SET svipdate = DATE(curdate()) + INTERVAL %d DAY WHERE id=%d",days,getElementData(plr,"player:uid"))) api="ec8b994a9b1f6c01f14d1ee43" 
end 

function getsPremiumDate(plrlocal queryA=exports['tiyl-db']:dbGet("SELECT * FROM tiyl_gracze WHERE id=? AND svipdate>NOW() LIMIT 1"getElementData(plr,"player:uid")) 
if (queryA and #queryA > 0) then 
return queryA[1].svipdate 
end 
return false    
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-28, 07:35


DaVeCS

Mapper






Wiek: 31
Na forum: 3386 dni
Posty: 193
Nick w MP: DaVe

Piwa: 59

Respekt: 70,5

Podaj b??dy z /debugscript 3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-28, 13:24


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Nie ma b??d?w w Db3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-28, 14:17


killercycDDS

Migacz






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

Piwa: 1659

Respekt: 22

poka? jak wygl?da struktura vipdate + po co Ci to na koniec?
api="ec8b994a9b1f6c01f14d1ee43"

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-28, 15:32


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Zobacz, czy zapisujesz stan premium po wyj?ciu z serwera.

Więcej informacji znajdziesz w Wikipedii MTA:

onPlayerQuit


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-28, 16:12


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
"killercycDDS" napisał/a:

poka? jak wygl?da struktura vipdate + po co Ci to na koniec?
api="ec8b994a9b1f6c01f14d1ee43"

https://imgur.com/2dOUOG6 Prosze

Wilq gdze to sprawdzi??? :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-28, 16:24


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Sk?d ja mam wiedzie? gdzie to b?dzie w twoim gamemodzie? To tw?j serwer, powiniene? wiedzie? gdzie co masz.
Szukaj w plikach frazy: "onPlayerQuit

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-08-29, 00:17


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
function loadPlayerData(plr)
    local result=exports["tiyl-db"]:dbGet("SELECT * FROM tiyl_gracze 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,"user:nickname",v.login1)
        setElementData(plr,"player:logged",true)
        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)
        setElementData(plr,"user:oranga",v.orank)
        setElementData(plr,"p:title",v.rp_tytul)
        setElementData(plr,"player:scorespedytor"v.scorespedytor)
        setElementData(plr,"nanky:x",v.nankyx)
        setElementData(plr,"nanky:y",v.nankyy)
        setElementData(plr,"nanky:z",v.nankyz)
        local queryA=string.format("SELECT * FROM tiyl_gracze WHERE id=%d AND vipdate>NOW() LIMIT 1"getElementData(plr,"player:uid"))
        local resultA=exports["tiyl-db"]:pobierzWyniki(queryA)
        if (resultAthen
            setElementData(plr,"player:vip",true)
            setElementData(plr,"player:vipdate",v.vipdate)
            setPlayerName(plr,"#FFD700"..getPlayerName(plr))
        else
            setElementData(plr,"player:vip",false)
        end
        local queryA=string.format("SELECT * FROM tiyl_gracze WHERE id=%d AND svipdate>NOW() LIMIT 1"getElementData(plr,"player:uid"))
        local resultA=exports["tiyl-db"]:pobierzWyniki(queryA)
        if (resultAthen
            setElementData(plr,"player:svip",true)
            setElementData(plr,"player:svipdate",v.svipdate)
            setPlayerName(plr,"#FFBF00"..getPlayerName(plr))
        else
            setElementData(plr,"player:svip",false)
        end
        setElementData(plr,"player:skin",v.skin)
        local org=exports["tiyl-db"]:dbGet("SELECT * FROM tiyl_organizacje WHERE uid=? LIMIT 1"getElementData(plr,"player:uid")) -- pobieramy tylko JEDEN rekord
        if org and #org > 0 then
            setElementData(plr,"player:organization",org[1].code)
            exports['tiyl-db']:dbSet("UPDATE tiyl_organizacje SET actived=curdate() WHERE uid=?"getElementData(plr,"player:uid"))
        end
        return true
    end
    return false
end

function savePlayerData(plr,quitType)
    local uid=getElementData(plr,"player:uid")
    if not uid then return end
    
    local money=getPlayerMoney(plr)
    local reputation=getElementData(plr,"player:reputation")
    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 minuty=getElementData(plr,"player:hours")
    local minutyduty=getElementData(plr,"player:workinjob")
    local rypy=getElementData(plr,"p:title")
    local scorespedytor=getElementData(plr,"player:scorespedytor")
    local xygetElementPosition(plr)
    local query=exports["tiyl-db"]:dbSet("UPDATE tiyl_gracze SET money=?, reputation=?, pjA=?, pjB=?, pjC=?, pjL=?, hours=?, worker=?, rp_tytul=?, scorespedytor=?, nankyx=?, nankyy=?, nankyz=? WHERE id=?"moneyreputationlicensealicenseblicenseclicenselminutyminutydutyrypyscorespedytorxyzuid)
    
    if quitType then
        exports["tiyl-db"]:dbSet("INSERT INTO Logi_wyjscie_serwer (uid,nick,quitType,serial,date,saved) VALUES (?,?,?,?,NOW(),?)"uidgetPlayerName(plr), quitTypegetPlayerSerial(plr), "zapisano")
        outputDebugString("Zapisano statystyki gracza "..getPlayerName(plr)..", pow?d wyj?cia: "..string.lower(quitType))
    else
        exports["tiyl-db"]:dbSet("INSERT INTO Logi_wyjscie_serwer (uid,nick,quitType,serial,date,saved) VALUES (?,?,?,?,NOW(),?)"uidgetPlayerName(plr), "brak powodu wyj?cia"getPlayerSerial(plr), "zapisano")
        outputDebugString("Zapisano statystyki gracza "..getPlayerName(plr))
    end
end
addEventHandler("onPlayerQuit"root, function() savePlayerData(sourceend)

addEvent("antyLost"true)
addEventHandler("antyLost"root, function()
local result=exports["tiyl-db"]:dbGet("SELECT * FROM tiyl_gracze WHERE id=?"getElementData(client"player:uid"))
if result[1].login2 == false then
setPlayerName(client,result[1].login)
else
setPlayerName(clientresult[1].login2)
end
loadPlayerData(client)
end)


Znalaz?em to, czyli teraz w kt?rej linijce musze doda? vipdate jak jest w bazie danych ??

[ Dodano: 2019-08-30, 00:26 ]
Naprawi?em wystarczy?o wgra? modu?
:->

Postaw piwo autorowi tego posta
 

 
Tagi: nadawanie :: 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 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