Hai, I’m not sure if anyone has done this before.
But i was wondering if anyone knew anyways.
I am currently storing all bans in-game and on my website, in my MySQLi, and checking in-game, if they are banned.
And when doing so, i was wondering if it’s possible to make it work along side DataStores.
Meaning, if i ban using an in game gui, it bans both in a DataStore, and using my MySQLi.
Making a failsafe of some sort, if DataStore or my database goes down.
I’ve relied too much on DataStore before, and it wasn’t as stable as i thought. (Note the serveruri is not pointing to the exact location, for security purposes)
I checked around on google, and on the Devforum, and the closest I’ve found is something like this, but it’s still not combining Datastore and Http.
Summary
serveruri = 'https://newstargeted.com/'
http = game:GetService('HttpService')
function RemoveFromGame(Player)
Player:Kick("You have been kicked for exploiting")
end
game.Players.PlayerAdded:connect(function(Player)
local result = http:GetAsync(serveruri..Player.userId)
print(result)
local result = http:JSONDecode(result)
if result["error"] then
print(result["error"])
elseif result["banned"] == "true" then
RemoveFromGame(Player)
print('Player "'..Player.Name..'" is banned and therefore removed from the game.')
elseif result["banned"] == "false" then
print('Player "'..Player.Name..'" is not banned.')
else
print('Unkown response')
end
end)
while wait(10) do
for _,Player in pairs (game.Players:GetPlayers()) do
local result = http:GetAsync(serveruri..Player.userId)
print(result)
local result = http:JSONDecode(result)
if result["error"] then
print(result["error"])
elseif result["banned"] == "true" then
RemoveFromGame(Player)
print('Player "'..Player.Name..'" is banned and therefore removed from the game.')
elseif result["banned"] == "false" then
print('Player "'..Player.Name..'" is not banned.')
else
print('Unkown response')
end
end
end