Last active
August 29, 2015 13:56
-
-
Save jasonmcleod/8963969 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PLUGIN.Title = "PlayersWebService" | |
| PLUGIN.Description = "Publishes player list to a website" | |
| local alternate = true | |
| function PLUGIN:Init() | |
| oxmin_mod = cs.findplugin("oxmin") | |
| oxmin_mod:AddExternalOxminChatCommand(self, "online", {}, cmdList) | |
| end | |
| function cmdList() | |
| local pclist = rust.GetAllNetUsers() | |
| local count = 0 | |
| local names = "" | |
| for key,value in pairs(pclist) do | |
| count = count + 1 | |
| end | |
| for i=1, count do | |
| names = names .. "," .. util.QuoteSafe(pclist[i].displayName) | |
| end | |
| webrequest.Send("http://YOUR_WEBSITE/online.php?key=SOME_FANCY_KEY&list=" .. names, function(code, content) if(code == 200) then print(content) end end) | |
| end | |
| function PLUGIN:OnUserDisconnect() | |
| timer.Once(3,cmdList); | |
| end | |
| function PLUGIN:OnUserConnect() | |
| cmdList(); | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'll need to post this php script on your own web server. Of course you could write this in any language, just have it accept the list and some token.