This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
cdel's profile picture

BanCheck

Started by cdel, 29 June 2014 - 09:35 AM
cdel #1
Posted 29 June 2014 - 11:35 AM
Greetings everyone :D/>,
I have created a way to check if a specific player has been banned on a server, this is possible using the Fishbans API and a JSON API by ElvishJerricco.

Install

pastebin get 4nRg9CHU json

pastebin get 4R0GXpqr bancheck

Images (Running in the epic LyqydOS :D/>)

Edited on 17 July 2014 - 07:18 AM
cdel #2
Posted 17 July 2014 - 09:17 AM
updated screenshots :D/>
theoriginalbit #3
Posted 17 July 2014 - 09:23 AM
This seems like a nice little utility for server owners, though I don't see any use for general users.

You might want to add a condition to make sure data was returned. When I tried this I typed in 'theoriginalbit' and it errored with bancheck:13: attempt to index ? (a nil value) as my username for Minecraft is TheOriginalBIT. You also may want to see if you can expand to using more ban checking services too for more reliable information.
cdel #4
Posted 17 July 2014 - 09:28 AM
This seems like a nice little utility for server owners, though I don't see any use for general users.

You might want to add a condition to make sure data was returned. When I tried this I typed in 'theoriginalbit' and it errored with bancheck:13: attempt to index ? (a nil value) as my username for Minecraft is TheOriginalBIT. You also may want to see if you can expand to using more ban checking services too for more reliable information.

Okay, thanks for the suggestion. Much appreciated :D/>
cdel #5
Posted 17 July 2014 - 10:02 AM
update: added arguments and username checking
Anavrins #6
Posted 17 July 2014 - 03:42 PM
Little bug, your "totalBans" will always stay at zero since it get reset every time the for loop iterate.

  else
    local totalBans = 0                 //-- Added declaration here
    for service, info in pairs(data.bans.service) do
      print("[INFO] Service: "..service.." Bans: "..info.bans)
      totalBans = totalBans + info.bans //-- Removed localization here
    end
    print("[INFO] Total Bans: "..totalBans)
  end
end
Edited on 17 July 2014 - 01:46 PM
cdel #7
Posted 18 July 2014 - 09:38 AM
Little bug, your "totalBans" will always stay at zero since it get reset every time the for loop iterate.

  else
	local totalBans = 0				 //-- Added declaration here
	for service, info in pairs(data.bans.service) do
	  print("[INFO] Service: "..service.." Bans: "..info.bans)
	  totalBans = totalBans + info.bans //-- Removed localization here
	end
	print("[INFO] Total Bans: "..totalBans)
  end
end

thanks, I have updated the code :D/>
jordyvl #8
Posted 15 November 2014 - 02:24 PM
i cant download it pastebin link doesnt work
Dog #9
Posted 15 November 2014 - 05:26 PM
According to Pastebin the paste has been removed.