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

Wysłany: 2019-12-12, 17:03


Fl!k







Wiek: 26
Na forum: 3733 dni
Posty: 162

Piwa: 18

Respekt: 50

Witam posiadam skrypt na sms-premium z paczki PSRPG 2.0 chcia? bym go przerobi? pod api serverproject , za pomoc stawiam piwko!!

skrypt:
function sprawdzIloscDni21(gracz)
    local spr = exports["pystories-db"]:dbGet("SELECT * FROM pystories_users WHERE id=? AND premiumplusdate>NOW() LIMIT 1", getElementData(gracz,"player:sid"))
    if (spr and #spr > 0) then
        return spr[1].premiumplusdate
    end
    return false
end

function ustawIloscDni23(gracz, dni)
    if sprawdzIloscDni21(gracz) then
    local wyk1 = exports["pystories-db"]:dbSet(string.format("UPDATE pystories_users SET premiumplusdate = DATE(premiumplusdate) + INTERVAL %d DAY WHERE id=%d", dni, getElementData(gracz, "player:sid")))
    return end
    local wyk1 = exports["pystories-db"]:dbSet(string.format("UPDATE pystories_users SET premiumplusdate = DATE(curdate()) + INTERVAL %d DAY WHERE id=%d", dni, getElementData(gracz, "player:sid")))
end

addEvent("skPremiumPlus", true)
addEventHandler("skPremiumPlus", root, function(kod, dni)
    local spr = "http://microsms.pl/api/v2/multi.php?userid=4762&code="..kod.."&serviceid=5975"
    fetchRemote(spr, wyk1, "", false, client, dni)
end)

function wyk1(responseData, errno, playerToReceive, amount)
    if errno == 0 then
    if string.find(responseData, "kod") then
    amount = nil
        if string.find(responseData, '"number":"72480"') then
            amount = 2
        elseif string.find(responseData, '"number":"74480"') then
            amount = 4
        elseif string.find(responseData, '"number":"76480"') then
            amount = 8
        elseif string.find(responseData, '"number":"91400"') then
            amount = 15
        elseif string.find(responseData, '"number":"91900"') then
            amount = 31
        elseif string.find(responseData, '"number":"92521"') then
            amount = 61
        elseif string.find(responseData, '"number":"92550"') then
            amount = 131
        end
        if not amount then return end
        outputChatBox("Zakupi?e? premium+ na "..amount.." dni.", playerToReceive)
        outputChatBox("[SMS Premium+] Gracz "..getPlayerName(playerToReceive).." zakupi? us?ug? PREMIUM+ na "..amount.." DNI!. Dzi?kujemy ?e nas wspieracie. Administracja PSRPG!", root, 34,124,255)
        setElementData(playerToReceive, "player:premiumplus", true)
        ustawIloscDni23(playerToReceive, amount)
        setPlayerNametagColor(playerToReceive, 255, 200, 0)
        triggerEvent("save:player",root,playerToReceive)
        triggerEvent("load:player",root,playerToReceive)
    else
        outputChatBox("Podany kod jest poprawny lub nie prawdiowy. Zg?o? si? do DylemaT'a ("..responseData..")", playerToReceive)
    end
end
end

function findPlayer(p, ph)
    for i,v in ipairs(getElementsByType("player")) do
        if tonumber(ph) then
            if getElementData(v, "id") == tonumber(ph) then
                return getPlayerFromName(getPlayerName(v))
            end
        else
            if string.find(string.gsub(getPlayerName(v):lower(),"#%x%x%x%x%x%x", ""), ph:lower(), 1, true) then
                return getPlayerFromName(getPlayerName(v))
            end
        end
    end
end


api serverproject:
https://admin.serverproject.eu/api/public/service/W8BQCLOUD9eEgNkudIEXRfZ4d/query


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-12, 17:06


AmaMa.

AmaMa.#3768






Wiek: 26
Na forum: 3348 dni
Posty: 182
Nick w MP: AmaMa.

Piwa: 1835

Respekt: 165,3
Respekt: 165,3Respekt: 165,3

Szym34kKacperQ,
local spr = "http://microsms.pl/api/v2/multi.php?userid=4762&code="..kod.."&serviceid=5975"

Musisz zmieni? w tej linijce.

Poczytaj w tym temacie, kt?ry zosta? stworzony jaki? czas temu.
https://gtao.pl/panel-premium-vt106344.htm

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-12, 17:13


Fl!k







Wiek: 26
Na forum: 3733 dni
Posty: 162

Piwa: 18

Respekt: 50

bo jescze mam taki kod:
https://admin.serverproject.eu/api/smsapi.php?key=0133286294070d3120f91de62&amount=$KWOTA&code=$KOD_SMS&desc=$OPIS


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-12, 17:25


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Ten link API, kt?ry teraz wys?a?e? jest poprawny. Tylko do niego musisz wstawi? kod z SMS tak samo, jak masz to wykonane obecnie w starym API. Wystarczy samo kopiuj wklej.
Mo?esz w sumie ju? zamkn?? w?tek.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-13, 23:18


Fl!k







Wiek: 26
Na forum: 3733 dni
Posty: 162

Piwa: 18

Respekt: 50

"Wilq" napisał/a:

Ten link API, kt?ry teraz wys?a?e? jest poprawny. Tylko do niego musisz wstawi? kod z SMS tak samo, jak masz to wykonane obecnie w starym API. Wystarczy samo kopiuj wklej.
Mo?esz w sumie ju? zamkn?? w?tek.


tak?:
function sprawdzIloscDni21(gracz)
    local spr = exports["pystories-db"]:dbGet("SELECT * FROM pystories_users WHERE id=? AND premiumplusdate>NOW() LIMIT 1", getElementData(gracz,"player:sid"))
    if (spr and #spr > 0) then
        return spr[1].premiumplusdate
    end
    return false
end

function ustawIloscDni23(gracz, dni)
    if sprawdzIloscDni21(gracz) then
    local wyk1 = exports["pystories-db"]:dbSet(string.format("UPDATE pystories_users SET premiumplusdate = DATE(premiumplusdate) + INTERVAL %d DAY WHERE id=%d", dni, getElementData(gracz, "player:sid")))
    return end
    local wyk1 = exports["pystories-db"]:dbSet(string.format("UPDATE pystories_users SET premiumplusdate = DATE(curdate()) + INTERVAL %d DAY WHERE id=%d", dni, getElementData(gracz, "player:sid")))
end

addEvent("skPremiumPlus", true)
addEventHandler("skPremiumPlus", root, function(kod, dni)
    local spr = "https://admin.serverproject.eu/api/smsapi.php?key=0133286294070d3120f91de62&amount=$KWOTA&code=$KOD_SMS&desc=$OPIS"
    fetchRemote(spr, wyk1, "", false, client, dni)
end)

function wyk1(responseData, errno, playerToReceive, amount)
    if errno == 0 then
    if string.find(responseData, "kod") then
    amount = nil
        if string.find(responseData, '"number":"72480"') then
            amount = 2
        elseif string.find(responseData, '"number":"74480"') then
            amount = 4
        elseif string.find(responseData, '"number":"76480"') then
            amount = 8
        elseif string.find(responseData, '"number":"91400"') then
            amount = 15
        elseif string.find(responseData, '"number":"91900"') then
            amount = 31
        elseif string.find(responseData, '"number":"92521"') then
            amount = 61
        elseif string.find(responseData, '"number":"92550"') then
            amount = 131
        end
        if not amount then return end
        outputChatBox("Zakupi?e? premium+ na "..amount.." dni.", playerToReceive)
        outputChatBox("[SMS Premium+] Gracz "..getPlayerName(playerToReceive).." zakupi? us?ug? PREMIUM+ na "..amount.." DNI!. Dzi?kujemy ?e nas wspieracie. Administracja PSRPG!", root, 34,124,255)
        setElementData(playerToReceive, "player:premiumplus", true)
        ustawIloscDni23(playerToReceive, amount)
        setPlayerNametagColor(playerToReceive, 255, 200, 0)
        triggerEvent("save:player",root,playerToReceive)
        triggerEvent("load:player",root,playerToReceive)
    else
        outputChatBox("Podany kod jest poprawny lub nie prawdiowy. Zg?o? si? do DylemaT'a ("..responseData..")", playerToReceive)
    end
end
end

function findPlayer(p, ph)
    for i,v in ipairs(getElementsByType("player")) do
        if tonumber(ph) then
            if getElementData(v, "id") == tonumber(ph) then
                return getPlayerFromName(getPlayerName(v))
            end
        else
            if string.find(string.gsub(getPlayerName(v):lower(),"#%x%x%x%x%x%x", ""), ph:lower(), 1, true) then
                return getPlayerFromName(getPlayerName(v))
            end
        end
    end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-13, 23:47


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Musisz do tego API dopisa? w odpowiednich miejscach kod i ilo?? dni tego premium, tak samo jak w poprzednim API mia?e?. Dwie kropki, zmienna i tak samo z drugim

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-14, 09:44


Fl!k







Wiek: 26
Na forum: 3733 dni
Posty: 162

Piwa: 18

Respekt: 50

"Wilq" napisał/a:

Musisz do tego API dopisa? w odpowiednich miejscach kod i ilo?? dni tego premium, tak samo jak w poprzednim API mia?e?. Dwie kropki, zmienna i tak samo z drugim


Cos takiego?

function sprawdzIloscDni21(gracz)
    local spr = exports["pystories-db"]:dbGet("SELECT * FROM pystories_users WHERE id=? AND premiumplusdate>NOW() LIMIT 1", getElementData(gracz,"player:sid"))
    if (spr and #spr > 0) then
        return spr[1].premiumplusdate
    end
    return false
end

function ustawIloscDni23(gracz, dni)
    if sprawdzIloscDni21(gracz) then
    local wyk1 = exports["pystories-db"]:dbSet(string.format("UPDATE pystories_users SET premiumplusdate = DATE(premiumplusdate) + INTERVAL %d DAY WHERE id=%d", dni, getElementData(gracz, "player:sid")))
    return end
    local wyk1 = exports["pystories-db"]:dbSet(string.format("UPDATE pystories_users SET premiumplusdate = DATE(curdate()) + INTERVAL %d DAY WHERE id=%d", dni, getElementData(gracz, "player:sid")))
end

addEvent("skPremiumPlus", true)
addEventHandler("skPremiumPlus", root, function(kod, dni)
    local spr = "https://admin.serverproject.eu/api/smsapi.php?key=0133286294070d3120f91de62&amount="..kwota.."code="..kod.."desc=Premium+"
    fetchRemote(spr, wyk1, "", false, client, dni)
end)

function wyk1(responseData, errno, playerToReceive, amount)
    if errno == 0 then
    if string.find(responseData, "kod") then
    amount = nil
        if string.find(responseData, '"number":"72480"') then
            amount = 2
        elseif string.find(responseData, '"number":"74480"') then
            amount = 4
        elseif string.find(responseData, '"number":"76480"') then
            amount = 8
        elseif string.find(responseData, '"number":"91400"') then
            amount = 15
        elseif string.find(responseData, '"number":"91900"') then
            amount = 31
        elseif string.find(responseData, '"number":"92521"') then
            amount = 61
        elseif string.find(responseData, '"number":"92550"') then
            amount = 131
        end
        if not amount then return end
        outputChatBox("Zakupi?e? premium+ na "..amount.." dni.", playerToReceive)
        outputChatBox("[SMS Premium+] Gracz "..getPlayerName(playerToReceive).." zakupi? us?ug? PREMIUM+ na "..amount.." DNI!. Dzi?kujemy ?e nas wspieracie. Administracja PSRPG!", root, 34,124,255)
        setElementData(playerToReceive, "player:premiumplus", true)
        ustawIloscDni23(playerToReceive, amount)
        setPlayerNametagColor(playerToReceive, 255, 200, 0)
        triggerEvent("save:player",root,playerToReceive)
        triggerEvent("load:player",root,playerToReceive)
    else
        outputChatBox("Podany kod jest poprawny lub nie prawdiowy. Zg?o? si? do DylemaT'a ("..responseData..")", playerToReceive)
    end
end
end

function findPlayer(p, ph)
    for i,v in ipairs(getElementsByType("player")) do
        if tonumber(ph) then
            if getElementData(v, "id") == tonumber(ph) then
                return getPlayerFromName(getPlayerName(v))
            end
        else
            if string.find(string.gsub(getPlayerName(v):lower(),"#%x%x%x%x%x%x", ""), ph:lower(), 1, true) then
                return getPlayerFromName(getPlayerName(v))
            end
        end
    end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-14, 10:17


Wilq







Wiek: 24
Na forum: 4569 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Ot?? to, je?li to co kryje si? pod tymi zmiennymi (kod i ilo?? dni chyba) zgadza si? z tym co musisz przekaza? w API to powinno dzia?a?. Spr?buj sam, wygeneruj sobie kod testowy (jesli mo?esz, serverproject chyba mia?o tak? mo?liwo??).

Postaw piwo autorowi tego posta
 

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