• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Request Plugin version checker
#1
Hi

Guys to improve my plugin performance i need a simple code to add in to my plugin to check plugin version from my site
and if new version of plugin is released every 3 minute in game say
"New version of Plugin is released pleas See our site".

I have idea to checking new version
1)may have sipmle way such as if in link "www.mysite.com/ver.txt
the valu 1 = new version or if valu 0 no new version and no need to update.
2)or by cheking MD5
3)or...

Thank you.
  Reply
#2
Store MD5 (or SHA1) in a http://www.mysite.com/ver.txt
[Image: azuw.jpg]
  Reply
#3
I Think this will help you
this is the one when i tried to do this on God Plugin but Since i Dont have a Site Dumb Bitch So I Removed it from my code

Code:
public override void OnServerLoad
         try
            {
                WebClient up = new WebClient();
                string download = up.DownloadString("http://www.mysite.com/update.txt");
                string[] downloads = download.Split(',');
               }
             if downloads = "1"
                ServerPrint("Update Is available")
                //whatever else you wanna add

Inform me if this works or sth else.
[-] The following 1 user says Thank You to OzonE for this post:
  • raminr63
  Reply
#4
The code is wrong anyway but checking for '1' in a text file doesn't make sense. Sure it will show 'There is an update' but after you updated it will show the message again because the text file still contains '1'. And then if you remove the '1' from the file, the people who haven't updated yet will never receive the update message.
[Image: azuw.jpg]
[-] The following 3 users say Thank You to zxz0O0 for this post:
  • Arteq, JariZ, OzonE
  Reply
#5
hmmm. true.
but still fixable.
i believe ramin can fix it, i dont have time for this.
  Reply
#6
Use the version number.
That's what I always do.
if(currentversion != serverversion) launchUpdater()
  Reply
#7
Uses System.Net and Sytem.Linq
CSHARP Code
  1. private const decimal Version = 1.2m;
  2. public overide void OnServerLoad()
  3. {
  4. WebClient version = new WebClient();
  5. decimal CurrentVersion = decimal.Parse(up.DownloadString("http://www.mysite.com/update.txt"));
  6. if(CurrentVersion!=Version)
  7. {
  8. Timer update = new Timer(int.Parse(GetServerCFG("myplugin","Update Notify","3000"));
  9. update.Elapsed+=(sender,e)=>
  10. {
  11. if(GetSeverCFG("myplugin","UpdateNotifyAdminOnly","false")!="false"&&GetClients()!=null)
  12. {
  13. foreach(string AdminXUID in GetSeverCFG("myplugin","Admin_XUIDs","").Split(new char[]{',',';'}))
  14. {
  15. ServerClient Client;
  16. if(TellClient(GetClients.Where(Client=>Client.XUID==AdminXUID).ToArray().Length!=0)
  17. {
  18. Client=GetClients.Where(Client=>Client.XUID==AdminXUID).ToArray()[0];
  19. TellClient(Client.ClientNum,"myplugin:New version available!!");
  20. }
  21. }
  22. }
  23. else
  24. ServerSay("myplugin:New version available!!", true);
  25. ServerPrint("myplugin:New version available!!");
  26. }
  27. update.Enabled=true;
  28. }
  29. }
UNTESTED
[-] The following 2 users say Thank You to archit for this post:
  • d0h!, raminr63
  Reply
#8
Hi @archit your code has many problem pleas recheck your code.

thank you.
  Reply
#9
Linq is not included in NET 3.0
[Image: azuw.jpg]
  Reply
#10
This should work
CSHARP Code
  1. public override void OnServerLoad()
  2. {
  3. WebClient version = new WebClient();
  4. decimal CurrentVersion = decimal.Parse(version.DownloadString("http://www.mysite.com/update.txt"));
  5. if (CurrentVersion != Version)
  6. {
  7. Timer update = new Timer(int.Parse(GetServerCFG("myplugin", "Update Notify", "3000")));
  8. update.Elapsed += (sender, e) =>
  9. {
  10. if (GetServerCFG("myplugin", "UpdateNotifyAdminOnly", "false") != "false" && GetClients() != null)
  11. {
  12. foreach (string AdminXUID in GetServerCFG("myplugin", "Admin_XUIDs", "").Split(new char[] { ',', ';' }))
  13. {
  14. ServerClient client;
  15. if (GetClients().Where(Client => Client.XUID == AdminXUID).ToArray().Length != 0)
  16. {
  17. client = GetClients().Where(Client => Client.XUID == AdminXUID).ToArray()[0];
  18. TellClient(client.ClientNum, "myplugin:New version available!!", true);
  19. }
  20. }
  21. }
  22. else
  23. ServerSay("myplugin:New version available!!", true);
  24. ServerPrint("myplugin:New version available!!");
  25. };
  26. update.Enabled = true;
  27. }
[-] The following 1 user says Thank You to archit for this post:
  • raminr63
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
Wink Plugin with !ban !kick and !tampban clemi555 3 1,732 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 1,999 11-08-2013, 19:13
Last Post: clemi555
  [Release] Bunker Plugin 1.3 archit 68 18,588 10-30-2013, 11:59
Last Post: clacki
  MW3 Server Version superg1973 7 7,199 10-28-2013, 01:15
Last Post: kotyra972
  Help Modifying plugin maverigh 5 2,675 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 1,924 10-19-2013, 06:59
Last Post: iRoNinja
  [Release] Yurio Map Plugin Yurio 101 30,154 09-26-2013, 13:38
Last Post: First_Semyon
Brick [Release] v1.1 ChangeMap/NextMap Plugin without any configuration milchshake 23 9,639 09-23-2013, 13:18
Last Post: SgtLegend
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 1,157 09-13-2013, 09:31
Last Post: Hallla
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 14,787 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks

Forum Jump:


Users browsing this thread: 1 Guest(s)