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.
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
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
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
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??).
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