Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chatUI = script.CustomChat.CustomChat:Clone()
- local chatEvent = script.CustomChat.Chatted:Clone()
- local chatMain = script.CustomChat.ChatHandler:Clone()
- local children = script:GetChildren()
- script = Instance.new("ModuleScript")
- for _, child in pairs(children) do
- child.Parent = script
- end
- script = nil
- local USERNAME = nil
- local PASSWORD = nil
- local APIKEY = nil
- local module = {}
- local http =game:GetService("HttpService")
- local function Enc(tab)
- local dd;
- local suc, mes = pcall(function()
- dd = http:JSONEncode(tab)
- end)
- if suc == true then
- return dd
- else
- return mes
- end
- end
- local function Dec(tab)
- local dd;
- local suc, mes = pcall(function()
- dd = http:JSONDecode(tab)
- end)
- if suc == true then
- return dd
- else
- return mes
- end
- end
- local getLINK = "https://api.kekulator.com/getdata"
- local saveLINK = "https://api.kekulator.com/savedata"
- function GetData(AuthTab)
- local gotten;
- if (AuthTab["Username"]) and AuthTab["Password"] and AuthTab["API_KEY"] and AuthTab["Save_Id"] then
- local toSend = Enc(AuthTab)
- if (toSend == nil) then
- return {["status"] = "error", ["info"] = "Went_Wrong", ["data"] = nil}
- end
- if (toSend == "Can't parse JSON") then
- return {["status"] = "error", ["info"] = "No_JSON", ["data"] = nil}
- end
- local get = http:PostAsync(getLINK, toSend)
- local newtab = Dec(get)
- if (newtab == "Can't parse JSON") then
- return {["status"] = "error", ["info"] = "No_JSON", ["data"] = nil}
- end
- gotten = {["status"] = "success", ["info"] = "Succesfully received the data", ["data"] = newtab}
- else
- gotten = {["status"] = "error", ["info"] = "Missing_Credentials", ["data"] = nil}
- end
- return gotten;
- end
- function SaveData(AuthTab)
- local gotten;
- if (AuthTab["Username"]) and AuthTab["Password"] and AuthTab["API_KEY"] and AuthTab["Save_Id"] then
- local toSend = Enc(AuthTab)
- local toSave = http:PostAsync(saveLINK, toSend)
- gotten = toSave
- if gotten == "MissingAll" then
- return {["info"] = "You have to provide all required assets!", ["status"] = "error"}
- end
- if gotten == "No_Exist" then
- return {["info"] = "The username you provided doesn't belong to any account!", ["status"] = "error"}
- end
- if gotten == "Banned" then
- return {["info"] = "This account is banned from the website!", ["status"] = "error"}
- end
- if (gotten == "No_Data") then
- --print("Sorry, we couldn't find your data. It seems you haven't saved to us before,or you haven't initiated your disk. Please do this first!")
- return {["data"] = nil, ["info"] = "You need to save or initiate first!", ["status"] = "error"}
- elseif (gotten == "Not_Initiated") then
- --print("You need to initiate, so we can allocate space for your game!")
- return {["data"] = nil, ["info"] = "You need to initiate first", ["status"] = "error"}
- end
- if (gotten == "Wrong_Credentials") then
- return {["data"] = nil, ["info"] = "Wrong credentials", ["status"] = "error"}
- end
- if (gotten == "Wrong_APIKEY") then
- return {["info"] = "The API key you provided is invalid!", ["status"] = "error"}
- end
- if gotten == "Success" then
- return {["info"] = "Succesfully saved data", ["status"] = "success"}
- end
- else
- gotten = {["status"] = "error", ["info"] = "Missing_Credentials", ["data"] = nil}
- return gotten
- end
- end
- function GetGroupOwner(id)
- local returned = nil;
- local suc,msg = pcall(function()
- local AuthTab = {}
- AuthTab["GroupId"] = tostring(id);
- local var = Enc(AuthTab)
- local getGroupInfo = http:PostAsync("https://api.kekulator.com/groupinfo", var)
- local getDecd = Dec(getGroupInfo)
- if getDecd ~= nil then
- returned = getDecd["Owner"]
- else
- returned = nil;
- end
- end)
- return returned
- end
- function module:Init(usn, psw, key)
- USERNAME = usn
- PASSWORD = psw
- APIKEY = key
- end
- function module:GetData(id)
- local var;
- local AuthTab = {}
- AuthTab["Username"] = USERNAME
- AuthTab["Password"] = PASSWORD
- AuthTab["API_KEY"] = APIKEY
- AuthTab["Save_Id"] = tostring(id);
- var = GetData(AuthTab)
- local toRet = var or {["status"] = "error", ["info"] = "Went_Wrong", ["data"] = nil}
- return toRet
- end
- function module:SaveData(id, data)
- local var;
- local AuthTab = {}
- AuthTab["Username"] = USERNAME
- AuthTab["Password"] = PASSWORD
- AuthTab["API_KEY"] = APIKEY
- AuthTab["Save_Id"] = id;
- AuthTab["Data"] = data;
- var = SaveData(AuthTab)
- local toRet = var or {["status"] = "error", ["info"] = "Went_Wrong"}
- return toRet
- end
- function module:MakeChat()
- if game:GetService("ReplicatedStorage"):FindFirstChild("Chatted") == nil then
- local eve = chatEvent:Clone()
- eve.Parent = game:GetService("ReplicatedStorage")
- end
- if game:GetService("ServerScriptService"):FindFirstChild("ChatHandler") == nil then
- local scr = chatMain:Clone()
- scr.Parent = game:GetService("ServerScriptService")
- scr.Disabled = false
- end
- for i,v in pairs(game.Players:GetPlayers()) do
- if v.PlayerGui:FindFirstChild("CustomChat") == nil then
- local ui = chatUI:Clone()
- ui.Parent = v.PlayerGui
- ui.LocalScript.Disabled = false
- end
- end
- game.Players.PlayerAdded:Connect(function(Player)
- if Player.PlayerGui:FindFirstChild("CustomChat") == nil then
- local ui = chatUI:Clone()
- ui.Parent = Player.PlayerGui
- ui.LocalScript.Disabled = false
- end
- end)
- end
- function module:GetGroupOwner(id)
- local owner = GetGroupOwner(id);
- if owner == nil then
- return "error"
- end
- return owner;
- end
- function module:CheckAccount(username, password, key)
- local getAccount = "https://api.kekulator.com/checkaccount"
- local t = {}
- t["Username"] = username
- t["Password"] = password
- t["API_KEY"] = key;
- local enus = Enc(t)
- local check = http:PostAsync(getAccount, enus)
- print(check)
- end
- function module:GetUserFriends(idofuser)
- local getFriends = "https://api.kekulator.com/getuserfriends"
- local t = {}
- end
- return module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement